;

PDA

Click to See Complete Forum and Search --> : KM and Databases? CSV, mdb...


Uwe S.
04-05-2006, 01:54 PM
Is there a possibility to integrate a lot of Textfiles with pictures...?
All Data are available in a Datasheet (Access or a csv File)

It would save a lot of time...

Thanks all for help

w.brants
04-05-2006, 02:38 PM
Access mdb files aren't possible without a server side language since they are binary files. CSV files can be read using the LoadVars class. Maybe you can be a bit more specific about what you are trying to accomplish.

Uwe S.
04-05-2006, 02:57 PM
Thanks...now
I have in my Database many Products... with Prices, Infos and many Picturepaths...
I have from these Products a csv File!

Can I load a Field (from my csv file) in a Listbox to select and then link to a page?

Example:
Product A with 10 Fields (Price, Info...)
Product B with 10 Fields (Price, Info...)
Product C with 10 Fields (Price, Info...)

KM should now import these Products (Infolist to click...) in a Listbox named Products
The Listbox should select Product A and link to the Main-Infopage with these 10 Fields (Price, Picture, Infotext....
We have many many Products...that means a lot of work....

Is that possible?

blanius
04-05-2006, 03:17 PM
Should be possible. Personally I'd still use serverside PHP to process the csv into a variables structure that KM could load.

Show example of actual data.

w.brants
04-05-2006, 03:22 PM
It's possible but how easy it will be depends on the complexity of the database.

When you use the LoadVars class, it's onData event is triggered as soon as the file is read and passes the entire file as one big string. That means you'll have to do the field conversion yourself. Normally you'll first use the String.split function to split it on \n (line feed). After that you have an array where each item contains a record. Then you split each record into fields. If the delimiter is always "," it's no problem. If it sometimes is , and sometimes "," it becomes more difficult because if you would split on , you would also split a string that contains a , as part of the string and not as a field separator.

How many records does your database contain ?
If it's very large it might take the flash player a little time to process the data.

Uwe S.
04-06-2006, 02:42 AM
Thanks all...
Germany 7:30 in the morning...KM is running...

My csv List shows some fields like:
Nr;Name;Artikelnummer;Kommentare;Beschreibung;
There are 300-500 entries...

Could you send me an example...? LoadVars class...? Difficult to understand ( Germany..) If it is to difficult, it would help me, if there is a possiblity to load data
from 1 field in a listbox. Then I would to the rest yourself

Bye
Uwe
P.S. My server can run csv Files and php...

w.brants
04-06-2006, 07:14 AM
Nr;Name;Artikelnummer;Kommentare;Beschreibung;
It seems like you are using ; as a field delimiter.
Here's an examplelv = new LoadVars(); // create a loadVars object

lv.onData = function(src){ // set the onData function

records = src.split('\n'); // create the record array
for (var i = 0; i < records.length; i++){
fields = records[i].split(';'); // split record into field array using ; as a field delimiter
records[i] = {label:fields[0], value:fields[2]}; // replace a record with a label and value for the listbox
}
_root.listbox1.setItems(records); // set the listbox items

}

lv.load('myData.csv'); // load the CSV fileIn the example I'm using the first and third field as label and value for the listbox. Of course you can use other fields. If the csv file starts with a line that shows the field names you have to start at var i = 1; to skip the first line.

Uwe S.
04-06-2006, 07:47 AM
wow...Thanks so much,

I will try it today...
That means, I drag a Listbox ...but where exactly must I place this code?
At Frame action?

Uwe


Uwe

w.brants
04-06-2006, 07:51 AM
but where exactly must I place this code?
At Frame action?
Yes, you attach the code to a frame where the listbox exists.

You will also have to set the onChange handler of the listbox to do something when the selection changes. You can do that using the gui's onChange parameter or integrate it into the code example.

blanius
04-06-2006, 07:57 AM
Wilbert won't he need to add src= to the begining of the csv file?

Uwe S.
04-06-2006, 07:59 AM
Ok ...I understand
I will try it....thanks...again
I posted today another big problem with images (Links...)
I would be very grateful, if you could help me! I can not fix it...

w.brants
04-06-2006, 08:01 AM
Wilbert won't he need to add src= to the begining of the csv file?
No, that would be if you use the onLoad event. The onData event proceeds that. When you set an onData event you can process any entire file that's not binary encoded. That's what makes it so powerful :)

blanius
04-06-2006, 08:05 AM
WOW I didn't realize this... This is significant to me...... Gotta go test some things.
You are such a great resource here. Thank you.

Uwe S.
04-06-2006, 09:16 AM
Hi Bret an Wilbert,

i have tried it but there is an error:

My csvFile named myData.csv in in the same Folder..

These are my DATA...

Nr;Name;Artikelnummer;Kommentare;
17424;Abschleppdienst;336;-;
17425;PC;336;-;Infos

I have changed this Line:
records[i] = {label:Nr[0], value:Name[1]}//

Nothing happens...

w.brants
04-06-2006, 09:20 AM
records[i] = {label:Nr[0], value:Name[1]}
You should't have changed it like that since there are no arrays named Nr or Name. If you want to use the first two fields, try it like thislv = new LoadVars();

lv.onData = function(src){

records = src.split('\n');
for (var i = 1; i < records.length; i++){
fields = records[i].split(';');
records[i] = {label:fields[0], value:fields[1]};
}
_root.listbox1.setItems(records);

}

lv.load('myData.csv'); // load the CSV file

Chris_Seahorn
04-06-2006, 09:44 AM
You are such a great resource here.

One wonders you aren't a mod here Wilbert? You are probobly the most adept at using the program other than Bob. Was it offered and turned down?

Uwe S.
04-06-2006, 10:03 AM
Everyone can use it but I have problems...
1. Drag my Listbox (Listbox1)
2. Edit Frame Action with this code above...
3. MyData.csv is there...

But nothing happens!

w.brants
04-06-2006, 10:50 AM
Uwe, Can you post a csv with the structure you are using without information that's important to you, It should be something small but without the fun or csv file I can't tell you what it is.

Chris, Bret and Bob do a great job moderating. Being a mod isn't my desire. It takes a lot of time since one has to read all posts and posting in english still takes me extra time since it isn't my native language.

Uwe S.
04-06-2006, 11:32 AM
Hi Wilbert,

all here are great and do their best!
We have to translate...and it is sometimes realy hard...
I included a Standard *.csv File for you
This file is working with other applications very well.
I can import it without problems.

Could it be on the header:
something like this

"Produkt-ID";"Bezeichnung";"Preis";"

thank you so much...
It is not possible to upload *.csv (rename the file...to: wilbert.csv)
:thumbsup:

blanius
04-06-2006, 12:31 PM
It's working you just need to understand what Wilbert has done in his code and go from there: I'll add comments

//create a loadVars Object
lv = new LoadVars();

//set what to do when it has loaded it's data
lv.onData = function(src){//src is the a "pointer" to the data

records = src.split('\n');//This splits the text at each new line and puts it into an array called records
//So for example your records[0] would contain the first line of the text file
for (var i = 1; i < records.length; i++){//Now loop through the array and split it each again at each ;
fields = records[i].split(';');
now fields[0] will contain the first item in the first line and fields[1] will contain the second item
records[i] = {label:fields[0], value:fields[1]};//Here he's reusing the records array and putting in the label and value pairs you need
}
_root.listbox1.setItems(records);//Set the label and Value using the array

}

lv.load('myData.csv'); // load the CSV file


What he didn't show you was something to show that the values are there

add

listbox1.onChange=function(){
_root.txt1.text=this.getValue()
}
and when you select an item in the list box it will show value in a text box called txt1

Uwe S.
04-06-2006, 03:00 PM
Hi Wilbert and Bret,

I loaded the fun file and the *.csv file!
But when I play it in web browser nothing happens!
Everything seems to be ok, Action Script... but only a blanc screen!
I also add the code from Bret...

I do not understand why?

w.brants
04-06-2006, 03:25 PM
Most likely you are not using Internet Explorer and your flash player is version 6 or 7. The example I created requires flash 8. IE checks the required version KM exports in the html code and will inform you to upgrade but browsers like FireFox don't do that.

KM 5.3 will have an automatic actionscript based check. As soon as you use a flash 8 component and someone with a flash 6 or 7 player wants to view it a warning message will be displayed.

Uwe S.
04-06-2006, 03:42 PM
Hi Wilbert,

I have the Internet Explorer!
My KM Version is 5,2,3,0
I am using Flash player 7
That means people with Version 6 cannot read this Data.
With my machine XP there was no message!
Could it be that a lot of People do not see any message? They see a blanc screen?
Do I have to download the Player 8 from Macromedia or is there
another possibility for User with older Versions?

w.brants
04-06-2006, 04:23 PM
I don't know why IE didn't warn you.

Attached is an updated zip file. I included the swf file created with the 5.3 beta so you can see how it will be displayed in the future if flash player 8 isn't present. I also included a modified v6 version for flash 6. There is a flash 6 version of the listbox but I consider the flash 8 version of the listbox to be superior with a better internal architecture compared to the flash 6 version.

Uwe S.
04-06-2006, 04:37 PM
Thank you so much for today!
Tomorrow morning I will try all posibilities!
I let you know...

It was a hard day (with me...) and you helped me so much...
1000 Thanks Wilbert...
and of course Bret and all the other Heros here...!
I need my bed now...10 houres KM let me sleep...

Uwe S.
04-07-2006, 02:36 AM
Good Morning Wilbert,

I hope you had a good sleep
7:00 am I try to open your files but some error are there:

1. csv2listboxv6.fun can't loaded
Message:...KoolMoves Version later than the current one!
unknown tag $bo$
2. I have the Version 5.2.3

Import SWF File

I tried to loading the smf File, but I see only 2 Textboxes

Version 8 csv2Listbox.fun is possible to load in Version 5.2.3

Could you send me the code of Version 6, then I try to laod
your first example (version 8) and replace there the code.

Another Day with Errors (the Best Friend of us...)

Bye Uwe

w.brants
04-07-2006, 06:46 AM
KoolMoves Version later than the current one!
My mistake, I accidently used the 5.3 beta. Try again with the zip file attached to this post.

I tried to loading the swf File, but I see only 2 Textboxes
Didn't you see any warning message displayed in red ?
The textbox in the center of the movie should contain a warning message. :confused:

Uwe S.
04-07-2006, 07:51 AM
wow...it is working!
Thanks so much Wilbert
Great... :thumbsup: :thumbsup: :thumbsup:

One queston..
Is that possible?

If I have a picture path in my *csv e.g. c:\Pictures\Product.jpg

Could I see this picture too like the text information? We have hundreds of images and it would realy safe a lot of time.

w.brants
04-07-2006, 08:00 AM
Yes, it's possible to load external images.

I don't know what format they are in. If you have also images in png format or any jpg files that are progressive jpg's you have to switch to flash 8. If you would use flash 8, you could use the content pane to easily load and display those images. You can also try the flash 6 content pane or create your own image loader.

Can you please answer my question also ?
Didn't you see a warning message in one of the boxes from the swf file I included ?

Uwe S.
04-07-2006, 08:52 AM
Hi Wilbert,

I have imported your swf and played it in Web browser with KM
I see 2 boxes "without text"! There is NO warning message!

One Picture question with contentpane1:
I changed the csv File as follow:
I made a Field Picture and the entry is c:\picture.jpg

1. I drag a contentpane1
2. I changed your code to: _root.contentpane1.setContent(4,v,0,0.5); ???

but how can I change the code to the csv that I can see the picture?

w.brants
04-07-2006, 09:11 AM
I'm totally confused :confused:

If you can see and use a flash 8 contentpane your flash player has to be flash 8. If it isn't you have to use the flash 6 version and in that case setContent(4,v,0,0.5) won't work.

I viewed the file I created with flash players 6, 7 and 8 and both 6 and 7 display a warning message at my computer. If anyone who reads this post has flash player 6 or 7 installed and wants to try please do so and let me know if you see a warning message. It's important for me to find out why it isn't working.
http://www.waterlijn.info/km/csv/test/index.html

Wilbert

Uwe S.
04-07-2006, 09:43 AM
Hallo Wilbert,

I have installed the player 8 from your link!
And a "message appeared" to install Player 8 I did it!
And... I can see all the Data!
KM can read all your files too

But, please help me with the code for the Picture in my csv file!
I am confused too...

Chris_Seahorn
04-07-2006, 09:59 AM
Didn't Wilbert give you many examples in your earlier Listbox threads? Are you taking the time to absorb them and understand them or just more comfortable posting a request that is always fulfilled?

w.brants
04-07-2006, 10:21 AM
Here's proof it can be done
http://www.waterlijn.info/km/csv/test/csv2listbox2.html

Assuming you are using the flash 8 code now, your images are in the right subdirectory and you dragged a contentpane on stage you just count the field number and use that to set the contentlv = new LoadVars();

lv.onData = function(src){

records = src.split('\n');
items = [];

for (var i = 0; i < records.length; i++){
var fields = records[i].split(';');
if (fields[0] > 0){
items.push( {label:fields[1]+' <font color=\'#808080\'>[ #'+fields[2]+' ]</font>', value:fields} );
}
}
_root.listbox1.setItems(items, false, new TextFormat('_sans',12), true);

_root.listbox1.onChange = function(v){
_root.txt1.text = 'Nr : ' + v[0];
_root.txt1.text += '\nArtikelnummer : ' + v[2];
_root.txt1.text += '\nBeschreibung : ' + v[4];
_root.contentpane1.setContent(4,v[8],0,0.5);
}

}

lv.load('myData.csv');

Uwe S.
04-07-2006, 10:23 AM
Hallo Chris,

this is not what I want to do!
I have realy problems to understand the komplexibility...I do not get ahead
I worked houres and houres on this problems with csv Files...
For you: since 7:00 am this morning

I regret that you think in such a way
Again thanks at Wilbert and its patience with me and to all others...

Chris_Seahorn
04-07-2006, 10:37 AM
You've shown no attempts. You ask and he provides. He is little by little building your whole sales routine and most of this you yourself have asked before..especially as it pertains to listboxes.

As all of this will be used for your business, you'll have to forgive my not feeling bad for pointing out you are not asking for support....you are always asking for code.

Your post history speaks for itself.

Uwe S.
04-07-2006, 12:18 PM
Dear Chris,

this is not like you are thinking...!

Buy a Software which is completely in Spanish and you as an English man should write a code "which is completely in spanish too" and you will try and read and have of course big big problems too.
For you it is very very easy and you think I do absolutely nothing?

You and all others here helped me a lot! Again to all THANKS.....

:hug: If I have the solution and it works I will post the solution for all foreign people which can feel like I do.

Uwe

Chris_Seahorn
04-07-2006, 12:29 PM
I have helped you in the past so I'm not being biased. Spanish is such a common language in my country, almost all things have a spanish translation. I think you rely on that excuse...it's convenient. It's working for you.....as your post history shows.

blanius
04-07-2006, 01:12 PM
ok Enough on the off topic rant....

Uwe S.
04-07-2006, 01:22 PM
Dear Wilbert,

I have in the meantime a bad conscience to ask you again:

I have flash code 8 now and I can see your beautyful example
But it doesn't work: I am realy confused

1. I changed the entry in my csv in the Field NR ( c:\picture.jpg)
2. I have a contentpane1
3. I changed the code...
but It doesn't work...
My contentpane shows only a! I tried other contentpane with pictures they work....

1. I changed the onchange Event in the Listbox (no chance...)

This is the csv..
Nr;Name;Artikelnummer;Kommentare;
C:\Picture.jpg;.....
It should work...?
I copied the picture in the folder where the fun file is....it doesn't work!

And I changed the Header of the csv....it doesn't work!

w.brants
04-07-2006, 02:50 PM
The exclamation mark is to indicate a file can't be found.

First change the 4 in setContent into a 0
_root.contentpane1.setContent(0,v[8],0,0.5);

That way it is treated as text and you'll see the actual filename that is passed. Check if these files really exist.

Uwe S.
04-07-2006, 04:06 PM
Thanks Wilbert, :)
wow....Yes, thats it!!!!
I would not have solved this problem without your patience!
MY fault was, it was the wrong field in my csv file and the "0" in the script!
There are many fields in the csv...
It was the 10 th Field where the syntax of the picture is!
I tried many fields, contentpane,*.jpg,*.png... now, the 10th and your changing of 0 thats it!
The combination of possibilities was very hard for me

Why shows the contentpane the 10th Field? I don't know... But it works
I am happy :)
:thumbsup: :thumbsup: :thumbsup:

Thank you for your patience with me!

msloat
05-29-2006, 12:44 PM
I was wondering if there is a way to take a file and slowly bring in names and address off of a text file or what ever? I was hoping to display names and address on a list. Slowly fading them in and then after 5 secs bring in the next name. Is there a way to do that? I am a newbie at this so you might have to explain a few things. Thank you.

blanius
05-29-2006, 05:09 PM
I was wondering if there is a way to take a file and slowly bring in names and address off of a text file or what ever? I was hoping to display names and address on a list. Slowly fading them in and then after 5 secs bring in the next name. Is there a way to do that? I am a newbie at this so you might have to explain a few things. Thank you.

Well the thread you posted in is pretty inclusive for that very kind of thing. Look it over and see if you can't work out how to use the code that Wilburt provided.

msloat
05-29-2006, 06:01 PM
Well the thread you posted in is pretty inclusive for that very kind of thing. Look it over and see if you can't work out how to use the code that Wilburt provided.

I was afraid you were going to say that. Ok, the code that he gives out, is this a script as far as Koolmoves is concerned. If so, how do you have the interface to interact with the script?

I just want to point out, after reading this thread, that I am not making any money off this. I just it out of fun. I have a Halloween site that shows all the home haunters on a flash map. Which I have working. I just wanted to shows those address in writen form as well.

blanius
05-29-2006, 07:44 PM
there are many ways to do what you want. Look at the thread again what did we ask the other guy? What does your data look like? What file format etc. then with that information you can use loadVars and onData to process the information.

You have a working map, ok what is it like how does it get information, is it dynamic or static, if dynamic how are you loading that information? etc etc........

msloat
05-29-2006, 08:16 PM
there are many ways to do what you want. Look at the thread again what did we ask the other guy? What does your data look like? What file format etc. then with that information you can use loadVars and onData to process the information.

You have a working map, ok what is it like how does it get information, is it dynamic or static, if dynamic how are you loading that information? etc etc........

The data from the map is dynamic, not from the user stand point yet, but from the admin. You can get a look at what I have now at www.gravemaker.info. Like you said there are many way you could do this. I could write a seperate txt file for the flash program to look at or I could use what the map flash is looking at. But it would be easier for me to write a another txt or excel file for it. Anyway, if you look on the right hand side of my website you will see the latest haunters to my group. That is the part that I want to turn to flash. So, I would need their haunt name, address, and a link to their website.(if any) So what I need to do is bring in all the data from each array and print it backwards until it gets to 1. Maybe pausing 5 sec in between. Mostly, I am a programmer wantabe. But the programming does look like C. I know enough to get me by. But after reading the thread, I have got it to display what I want expect making the URL clickable. And I have not learned how to make it start at the end of the file and start counting back. Any suggestions?