populating table with csv data
Alex Tweedly
alex at tweedly.net
Fri Apr 14 10:30:20 EDT 2006
Marielle Lange wrote:
> Dear Viktoras
>
> You can directly put a data file separated by tabs in a table field
> (put tData into field "somefield").
And so, it at all possible, try to arrange to get your data in Tab
Separated form - it will save you endless heartache :-)
> If your data are separated with another separator, then you need a
> function to replace that separator with a tab. This could be
> something like that (untested)
<snipped some code that, sadly, doesn't work>
The problem is that an 'item' in rev does not pay attention to quotes
(in Rev, quotes surround words, not items). so if you have input like
"Doe, John", "27"
there are two fields in the desired interpretation - but there are three
items
"Doe
John"
"27"
and so the snipped code will unfortunately replace the commas within fields.
If you really, really, can't get the data in TSV, and you have to deal
with CSV, then you can find a number of pre-written scripts to handle this
Richard Gaskin posted a nice, clean version in
http://lists.runrev.com/pipermail/metacard/2002-June/001767.html
I have a slightly more efficient, but much less legible, understandable
or maintainable one, in
http://mail.runrev.com/pipermail/use-revolution/2004-July/038738.html
(if you need to handle the weird case where quotes within fields are
handled by doubling the quote, you should see Richard's refinement in
the following message in that thread).
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.1/311 - Release Date: 13/04/2006
More information about the use-livecode
mailing list