BTW, Sku would have quotes around too, not a number. just a typo on my part. I am sure you knew that, it just bugged me that I did that.

--�

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040

On Jun 7, 2005, at 6:36 PM, Robert Garcia wrote:

yes, that will work, unless you have something like this in say a product table

rowid,sku,name,description,price
1,SJU-1234,"Black Widget","This is a cool widget.",5.99
2,URF-2343,"Blue Widget","This is also a cool widget, with a cooler color",3.99

The description of the second product, will be seen as 2 columns, and witango will error if you don't account for double quotes, and CSV files should not have quotes around numbers. I have done exactly what you have done, and it works fine if CSV is a known entity, and you don't have to worry about it. But if it can vary, it'll break.

--�

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040

On Jun 7, 2005, at 4:59 PM, Stefan Gonick wrote:

What I have done is read in the file into a variable. I then replace "," with <@char 9>.
I then tokenize the file variable into lines. When processing each line, I tokenize on
<@char 9> to get the values and remove the extra double quote from the beginning
of the first value and the end of the last value. That works fine.

Stefan

At 07:50 PM 6/7/2005, you wrote:
That should work, unless it is comma delimited, and any values are double quoted with commas in them. If you use array tag and tokenize, it will break up a field with a comma in it, ignoring double quotes. Maybe someone has a class or snippet they have wrote.

I do it by writing a command line app that uses MS DSN Less connection using installed MS CSV driver, call from witango as external action with env var specifying file name and CL app spits back what I need.

That would be a really great tool for witango, the ability to make DSN Less connections so you could use ODBC drivers on the fly with CSV and access tables and such.

--

Robert Garcia
President - BigHead Technology
VP Application Development - eventpix.com
13653 West Park Dr
Magalia, Ca 95954
ph: 530.645.4040 x222 fax: 530.645.4040
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/

On Jun 7, 2005, at 1:14 PM, Jason Pamental wrote:

Steve,

Do a file read and save it to a variable (i.e. request$mycsvfile)

Then create a new var with the array tag rather than tokenize.

An example with a tab-delimited file would be something like:

�<@assign name=request$mycsvfilearray value=<@array rdelim="<@crlf>" cdelim="<@char code='9'>" value="<@var request$mycsvfile>">

You could simply replace the <@char code=9> (a tab) with a comma if you need to, but it should still work.

Hope that helps (and that I remembered the process correctly)

Jason

-----

Jason Pamental
Director of Web Services
North Sails

Office: 401.643.1415
Fax: 401.643.1420
Mobile: 401.743.4406
Email: [EMAIL PROTECTED]

On Jun 7, 2005, at 4:08 PM, Fogelson, Steve wrote:


I am reading an Excel CSV file into an array with a Read Action.


I then tokenize it with the following:


<@assign request$SKUArray "<@tokenize value='<@var request$SKUArray>' chars='<@char code="10">'>">


I would like each row in the CSV file to be in a separate row in the array, but all the CSV rows are in one row in the array.


Is there a way to do this?


Thanks


Steve Fogelson
Internet Commerce Solutions


________________________________________________________________________
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

________________________________________________________________________
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