reading CSV text file

Dave dave at looktowindward.com
Sat Jun 23 01:15:46 EDT 2007


Hi,

Not sure what you are asking? Do you want to know how to get rid off  
the quote characters?
If so, just do this on the line that is read in:

replace quote with empty in myCSVLine

Then just break off all the fields using "," as the delimiter as in:

put item 1 of myCSVLine into myNameOfField1
put item 2 of myCSVLine into myNameOfField2
put item 3 of myCSVLine into myNameOfField3

Hope this helps
All the Best
Dave

On 22 Jun 2007, at 23:11, Viktoras Didziulis wrote:

> In cases like this I usually open the csv with my OpenOffice and  
> save it
> with record delimiter set to tab and no text delimiter (e.g.  
> ordinary tab
> delimited file). Then I go to my Revolution studio :-). Otherwise  
> it is a
> real headache to process the "correct" csv files as some "clever"  
> programs
> also put quotes around text strings only and don't put quotes  
> around numbers
>  etc, etc...
>
> You can also load that real csv into mysql and then get it out as tab
> delimited. SQLite might also be of some help - just put it into the  
> db and
> get it back with select *.
>
> Viktoras
>
> -------Original Message-------
>
> From: runrev260805 at m-r-d.de
> Date: 06/23/07 00:36:15
> To: use-revolution at lists.runrev.com
> Subject: reading CSV text file
>
> Hi,
>
> i have to read a textfile, which is comma separated and contains "  
> as text
> identifier. The item delimiter is ,
> My problem is, i do not know, how can i read the file and detect  
> each item
> of a line, as the items are sepearated by comma and the textfield/ 
> items
> could contain comma, too. How can i tell Revolution to ignore the  
> comma in
> the "tesxtarea of an item"
>
> Heres an example line
>
> "7722"," ","Fuji Cleaning Cartridge fr DLT Streamer, retail","DLT
> Reinigungskassette fr bis zu 20 Reinigungen nicht fr DLT 1 und  
> VS!","","",
> BAND","183","Diverse Hersteller","42419", 
> 31.03,38.79,35.27,34.48,34.48,34.48
> 32.66,0.000,0.000,"",24
>
> As you can see, some fields/items are included in " ,others (the  
> numeric
> values) are not. The field included in " could contain , .
>
> Any idea, how i can solve that. I have to mention that in the
> textfields/items there could be also the " as product description  
> e.g. TFT
> 19" or HDD 2.5"
>
>
> Regards,
>
> Matthias
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list