HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Dae
Someone help me... I need a way, other then using DTS to insert data into a SQL table. I was able to find some code on easyCFM.com, and it works, but only with comma delimited files. What I need to know is how I might be able to correct this so I can use files with other delimiters. Below is

RE: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Brad Wood
It would appear that not all the lines of your input file have four values. Keep in mind current versions of CF ignore empty list elements. Ex: item1,item2,,item4 The above comma delimited list only has 3 items, even though it would appear to have 4. (Word is, CF8 fixed that) ~Brad

RE: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Brad Wood
Wait, I just noticed the fourth listgetat doesn't specify a delimiter-- which means it is defaulting to a comma. That would cause problems when using a | or ~ delimiter. (or technically, anything OTHER than a comma) If you change the fourth line to '#listgetAt('#index#',4,'|')#' that should

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Christopher Jordan
Dae, I have questions: cfloop index=index list=#txtfile# delimiters=#chr(10)##chr(13)# cfquery name=importtxt datasource=sqlconnect INSERT INTO testload (date_add,name,phone,zip) VALUES ('#listgetAt('#index#',1, '|')#',

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Charlie Griefer
On 7/19/07, Dae [EMAIL PROTECTED] wrote: Invalid list index 4. In function ListGetAt(list, index [, delimiters]), the value of index, 4, is not a valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list.The error

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Dae
Thank you Charlie!! I didn't think it needed one because after the 4th field, it's a CR/LR. Regardless, changing to: '#listgetAt('#index#',4, '|')#', WORKED!!! THANK YOU!!! - Dae === On 7/19/07, Charlie Griefer [EMAIL PROTECTED] wrote: On 7/19/07, Dae [EMAIL PROTECTED]

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Janet MacKay
Someone help!! How do I fix it to work with other delimiters? I get the below error if I can the comma to say a pipeline '|'. I made sure to change the test.txt file to match. *15 :'#listgetAt('#index#',4)#'* Also, you forgot the pipe delimiter on the last line

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Jake Pilgrim
The performance of cffile action=read and cfloop list=file, delim=end of line chars is terribly poor... Furthermore (as you have found out), there's usually a lot of trial and error getting this to work. Assuming you have a well-formatted delimited text file, the best approach is to use

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Dominic Watson
Also again, It isn't necessary to have all those pound signs in your listgetat statements. The following will work: cfquery name=importtxt datasource=sqlconnect INSERT INTO testload (date_add,name,phone,zip) VALUES ('#listgetAt('index',1, '|')#',

RE: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Dave Francis
Please - Using Coldfusion to Import delimited txt files. Someone help me... I need a way, other then using DTS to insert data into a SQL table. I was able to find some code on easyCFM.com, and it works, but only with comma delimited files. What I need to know is how I might be able to correct

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Christopher Jordan
Dominic's right. I missed the quotes around the index variable. oops! :o) Chris On 7/19/07, Dominic Watson [EMAIL PROTECTED] wrote: Also again, It isn't necessary to have all those pound signs in your listgetat statements. The following will work: cfquery name=importtxt

RE: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Brad Wood
-Original Message- From: Dae [mailto:[EMAIL PROTECTED] Sent: Thursday, July 19, 2007 1:22 PM To: CF-Talk Subject: Re: HELP Please - Using Coldfusion to Import delimited txt files. Thank you Charlie!! I didn't think it needed one because after the 4th field, it's a CR/LR. Regardless, changing

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Kris Jones
Ben Nadel wrote a nice function for parsing csv-type files that works very well: http://www.bennadel.com/index.cfm?dax=blog:498.view Cheers, Kris ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7

Re: HELP Please - Using Coldfusion to Import delimited txt files.

2007-07-19 Thread Christopher Jordan
Nice Tip Jake! Chris On 7/19/07, Jake Pilgrim [EMAIL PROTECTED] wrote: The performance of cffile action=read and cfloop list=file, delim=end of line chars is terribly poor... Furthermore (as you have found out), there's usually a lot of trial and error getting this to work. Assuming you