Thanks for the replies, it seems like I'm taking the wrong approach.

Currently I am using a cfloop to loop over the file, then

#listgetat(FileLine,1)# to reference each field. 



<cfloop file="C:\CSVs\2010-05-21.csv" index="FileLine">

<cfset record_type = '#listgetat(FileLine,1)#'> 

</cfloop>



It seemed like a pretty simple solution and was working fine until I came

across fields with commas. As far as I can tell I can't use "'" as the

delimiter with listgetat. Does anyone have a better approach? Thanks again.





On Thu, 3 Jun 2010 10:37:34 -0700, Judah McAuley <[email protected]>

wrote:

> Any delimited file that has delimiters contained within a field is

> supposed to use a text qualifier. For CSV, the most common qualifier

> is double quotes, so your file would look like:

> 

> "1234","field 1","my big field, that has a delimiter or two, but is

> qualified"

> 

> If there are not text qualifiers and a field includes a qualifier then

> it isn't a valid csv file. If it is qualified, you should break the

> line up using the compound string "," as what you are splitting on,

> then remove the first and last qualifiers.

> 

> Hope that helps,

> Judah

> 

> On Thu, Jun 3, 2010 at 10:32 AM,  <[email protected]> wrote:

>>

>> I'm trying to import a comma delimited CSV file using <cfloop

>>

>> file="filename.csv">, but some records contain commas and they are

>> throwing

>>

>> everything off. I can't seem to figure out how to replace the in-field

>>

>> commas without messing up the delimiter. Any ideas? Thanks in advance.

>>

>>

>>

>> -Paul

>>

>> 

> 

> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334278
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to