Hello,
This worked quite well for me until this morning when I added 2 additional fields to the database to separate first, last and mi.
Here's a sample of the text file:
JOHN|G|SMITH|JOHNGSMITH@ATT.NET|MARCOS GONZALEZ|NEW ACCOUNT
Here's my code:
And finally my error:
Invalid list index 2.
In function ListGetAt(list, index [, delimiters]), the value of index, 2, 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 occurred in C:\Inetpub\ line 75
73 : VALUES
74 : ('#listgetAt('#index#',1, '|')#',
75 : '#listgetAt('#index#',2, '|')#',
76 : '#listgetAt('#index#',3, '|')#',
77 : '#listgetAt('#index#',4, '|')#',
This worked quite well for me until this morning when I added 2 additional fields to the database to separate first, last and mi.
Here's a sample of the text file:
JOHN|G|SMITH|JOHNGSMITH@ATT.NET|MARCOS GONZALEZ|NEW ACCOUNT
Here's my code:
Code:
<cffile action="read" file="C:\Inetpub\[URL unfurl="true"]wwwroot\hg\clup\files\#dirlist.name#"[/URL] variable="txtfile">
<!--- loop through and insert into database --->
<cfloop index="index" list="#txtfile#" delimiters="#chr(10)##chr(13)#">
<cfquery name="importtxt" datasource="#korn#">
INSERT INTO com_custs (gencustfname,gencustmi,gencustlname,gencusemail,genagent)
VALUES
('#listgetAt('#index#',1, '|')#',
'#listgetAt('#index#',2, '|')#',
'#listgetAt('#index#',3, '|')#',
'#listgetAt('#index#',4, '|')#',
'#listgetAt('#index#',5, '|')#'
)
</cfquery>
And finally my error:
Invalid list index 2.
In function ListGetAt(list, index [, delimiters]), the value of index, 2, 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 occurred in C:\Inetpub\ line 75
73 : VALUES
74 : ('#listgetAt('#index#',1, '|')#',
75 : '#listgetAt('#index#',2, '|')#',
76 : '#listgetAt('#index#',3, '|')#',
77 : '#listgetAt('#index#',4, '|')#',