I'm trying to import a CSV, do some fiddling with it, then save it off
as a file again. Some of the fields contain commas within them, so these
fields are all enclosed in double quotes. I am reading in the file like
this:
<cffile action="read" file="c:\inetpub\wwwroot\test.csv"
variable="origCSV">
<cfset temp = StructNew()>
then looping over it like this:
<cfset counter = 0>
<cfloop list="#origCSV#" index="w" delimiters="#chr(10)##chr(13)#">
<cfset counter = counter + 1>
<cfset temp[counter] = StructNew()>
<cfset temp[counter].raw = w>
<cfset counter2 = 0>
<cfloop list="id,title,blurb,ReleaseDate" index="q">
<cfset counter2 = counter2 + 1>
<cfset temp[counter][q] =
ListGetAt(temp[counter].raw,counter2,",")>
</cfloop>
</cfloop>
Which is fine, except it's not taking into account commas that appear in
the title or blurb fields. I'm sure there's a simple answer, but I'm at
a loss to see it. Any ideas?
Thanks heaps,
Kay.
______________________________________
Kay Smoljak Web Developer
Custom Tags: developer.perthweb.com.au
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists