CSV-parsing post?

Alex Tweedly alex at tweedly.net
Sat Dec 4 17:50:08 EST 2004


At 00:59 04/12/2004 -0600, Ken Ray wrote:

>Here's what I have from Alex Tweedly that uses split:


That's the overall approach to CSV parsing that Richard was referring to; 
the version you have included here is (I think) the end of the original 
thread (from July).

I later found a problem and posted a fix to that in October, at
   http://lists.runrev.com/pipermail/use-revolution/2004-October/045450.html

The problem is the

>    repeat for each element k in pData

because this does the elements in the INTERNAL order of the hashed array - 
we need them in numeric key order. (It worked OK on testing I did up to 
about 4000 lines of CSV file but failed (dramatically) after that.)  This 
had to be changed to

  repeat with tCounter = 1 to the number of lines in the keys of pData
      put pData[tCounter] into k

I don't remember whether I changed anything else or not - I'm fairly sure I 
didn't but I'd recommend taking the code from the October posting to 
replace the July version.

-- Alex.


More information about the use-livecode mailing list