I'd say the first thing to try is ask him if he can produce csv files
with all fields quoted.  That may or may not be possible, depending on
the program he's using and his level of expertise, but you could ask.

If that's not possible, are they standard files?  By which I mean, the
same columns always have the same datatype:
123,456,"COL3",789,"Col,5",012

If so, you could probably write a regex to replace the field delimiter
columns with another character, something like:

Find:
^([0-9]*),([0-9]*),(".*"),([0-9]*),(".*"),([0-9]*)$
Replace with:
^\1|\2|\3|\4|\5|\6$

which would give you:
123|456|"COL3"|789|"Col,5"|012

You'd still have to loop through all the lines, though.

Then you can assign it to a witanto array as below, just change your
cdelim to the pipe character.

(The above is a Unix-style regex in UltraEdit.  Test the code for
yourself - no warranties, express or implied.  ;^P
I'm not that familiar with Witango or Javascript regex, so I can't help
you much there.)

Hope this might help.

jamileh


> -----Original Message-----
> From: Wayne Irvine [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 15, 2004 12:44 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Witango-Talk: Import CSV
> 
> 
> > heres a simple way to get csv data into a witango array:
> > 
> > <@assign user$csvdata value="<@array cols=2 value='<@arg csvdata>' 
> > rdelim='<@crlf>' cdelim=','>">
> > 
> > dunno if that helps any, just tossing it out hoping that it does
> 
> That doesn't address the issue of fields containing commas 
> which is the sole reason for this question in the first place?
> 
> Wayne Irvine
> 
>                   Byte Services Pty Ltd
>                http://www.byteserve.com.au/
>                   [EMAIL PROTECTED]
>    Ph 02 9960 6099   Mob 0409 960 609   Fax 02 9960 6088
> 
> ______________________________________________________________
> __________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
> 
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to