well, if its a tab delimited file, you have to read it in, and turn it into an array, or something like that for witango to be able to then insert the values into a db.

CSV can be challenging, if you have to deal with quoted values and such, the easiest is some type of delimited file, that does not have quoted values. If you can specify the file type, an easy one is to do something like PIPE delimited. So lets say your file looks like this:

val1|val2|val3|val4
val21|val22|val23|val24

Normally it would have many lines. You would read in the file into memory, in a var, like local$myfile

You then need to use tokenize to get an array of lines by tokenizing by line endings, and then tokenize fields with the pipe. Then insert the array.

Some cautions:

You have to KNOW ahead a time the type of line endings on this file, are they windows CRLF, or mac, CR, etc. If you don't know, you have to also create a method to determine that. Its not TOO hard.

Second, this is not a strong point of witango. First, you have to load the ENTIRE file into memory to begin, because the read action cannot read by line, only by bytecount, or entire. Also, iterating through large files, will choke witango, looping and processing is a witango killer.

Your best bet, is to write an app, or VB script or something, to do this for you, and then call it from witango. With VB or RB you can read line by line, you can use a CSV class to parse the file, their are many advantages.

If these will be relatively small files, you should be able to do it fine in witango. If they are large and frequent, look at available solutions in Perl, VB, RB, etc.

--

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 Nov 28, 2007, at 11:01 AM, WebDude wrote:

Don't mean to ask dumb questions, but what do you mean by parse the file?


From: Robert Garcia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 28, 2007 12:53 PM
To: [email protected]
Subject: Re: Witango-Talk: Upload then Import

Sure, you just do an upload form, parse the file, and insert/update.

--

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 Nov 28, 2007, at 10:39 AM, WebDude wrote:

Witango 2000
MSSQL 7
W2k Server

I there a way or routine to upload a file (csv, tab delimited, xsl or whatever) and then import into an existing table? I am hoping for a Witango solution. Anyone ever do something like this?

Thanks!


________________________________________________________________________
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


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

Reply via email to