I am using some code that i got from Ben Nadel
I have added in some code to use my .csv file
<cffile action="READ" file="C:/ColdFusion10/cfusion/wwwroot/kelly2/debitorders.csv" variable="FileContent" result="csvfileupload">
<cfset CSVArray = FileContent>
<cfdump var="#CSVArray#">
<cfsavecontent variable="csv">
csvfileupload
</cfsavecontent>
<!--- Parse the test data. --->
<cfset result = csvToArray(
csv = trim( CSVArray )
) />
<!--- Output the results. --->
<cfdump
var="#result#"
label="Array 1"
/>
I would like to loop through the results however when I use
<cfloop array="#result#" index="i">
<cfoutput>#i#</cfoutput>
</cfloop>
I get the following error:
"Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values."
I would also like to know how I can refer to each of these items and their columns, not sure if my terminology makes any sense
My end goal is to go through the csv and read it line by line, sorting out the data depending on a variable within the line and then writing it to a new .txt file. Please let me know if I am on the right track or should rather do something different.