my code:
<cffile action="read" file="http://website.com/test1.txt" variable="data" attributes="readonly" >
<cfoutput >
#data#
</cfoutput>
<cfloop index="i" list="#data#" delimiters= "#chr(9)#" >
<cfquery datasource="X" username="Y" password="Z" timeout="90">
INSERT INTO property
(
PublicRemarks,
MLSID)
VALUES
(
'#replace(listGetAt(i,1),'"','','all')#',
'#replace(listGetAt(i,2),'"','','all')#'
)
</cfquery>
</cfloop>
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 D:/home/manpcs.com/wwwroot/Untitled_cfm.cfm: line 19 | |
17 : ( 18 : '#replace(listGetAt(i,1),'"','','all')#', 19 : '#replace(listGetAt(i,2),'"','','all')#' 20 : 21 : ) | |
My Question:
This is a tab delimited txt file. I am attempting to break the data up so that I can store it in my database. The data is being read as I can see from the output however I am unable to properly separate the data for my database. How do I properly seperate the data so that it will go into my database?
Thank you in advance for any and all help.