Comma-delimited values

Jim Bufalini jim at visitrieve.com
Mon Mar 8 13:13:54 EST 2010


Gregory Lypny wrote:

> Hello everyone,
> 
> I'm creating an app that imports comma-delimited tables.  A few lines
> might look like this, where there are 14 items per line.
> 
> "Mon, Jan 18 , 2010",9:14 AM,130557,4319,Trade,Buy,X,135,8.25,10,-
> 82.5,1417.5,20,10
> "Mon, Jan 18 , 2010",9:14 AM,130558,4371,Accept,Your
> ASK,X,135,8.25,10,82.5,1582.5,0,10
> 
> My problem is that Rev treats each date in quotes as three items rather
> than one.  I convert the comma delimiters to tab by setting the
> itemDelimiter to comma and then running the lines through nested
> repeat-for-each loops as
> 
> repeat for each line thisLine in dataTable
> repeat for each item thisItem in thisLine
> put thisItem & tab after newLine
> end repeat
> -- more stuff here
> end repeat
> 
> I end up with
> 
> "Mon	(as the first item)
> Jan 18	(as the second)
> 2010"	(as the third)
> 
> Any suggestions as how I might get the date treated as one item?

Almost all programs like spreadsheets that export tables in CSV format have
two options that you can set:

1. You can use tab instead of comma as the value delimiter.
2. You can tell it not to use quotes around text and dates.

So, export the tables in tab delimited format and without quotes. Then, when
importing into Rev, *set itemdel to tab*. If your spreadsheet program
insists on quotes, then *replace quote with empty in tImportedData* after
importing the data into rev.

Then you can use items and lines to work with the imported data in rev
without necessity of any data manipulations.

Aloha from Hawaii,

Jim Bufalini




More information about the use-livecode mailing list