A properly formatted csv file has double quotes around all fields,
not just text fields. In that case,  I have done the following to
read in a csv file:

1. parse the file into text lines
2. for each line:
    a. Replace <@dq>,<@dq> with |
    b. tokenize using |
    c. omit <@dq> from the first and last array elements

That's worked for me every time.

Stefan

At 01:41 AM 4/15/2004, you wrote:
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

----- Original Message -----
From: "Chris Smith - Comcast Acct" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 14, 2004 10:29 PM
Subject: RE: Witango-Talk: Import CSV


> I would load csv into temp table. > that way you can loop and use the data from the temp table for inserts into > the product table more efficiently > you could then empty the temp table after the action is performed. > csmith > > -----Original Message----- > From: Wayne Irvine [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 15, 2004 1:18 AM > To: [EMAIL PROTECTED] > Subject: Re: Witango-Talk: Import CSV > > > > Does the database that you are importing to able to import CSV format? > Have > > you tried just uploading file as is then automate the database import? > > I'm not directly importing to the database. The database contains all sorts > of product information. The data file is product code, current stock level, > and some other guff such as title and genre. > > The task is to go through each record in the data file and see if there is a > corresponding record in the db. If there is then we update the stock value > (and ignore all other fields). If there isn't we add a new record. > > Someone must have developed a solution for CSVs. I guess I could parse the > file and replace all commas occuring after an even number of " but it does > seem rather archaic and probably redundant. > > Wayne > > 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

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

=====================================================
Database WebWorks: Dynamic web sites through database integration
http://www.DatabaseWebWorks.com


________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to