The easiest solution is to make sure that there are no CR/LF in your
text. Replace them by some code when you create the csv file.
When you have to treat the elements, replace the codes by CR/LF.

If this is not an option, you should read each field separately in a
condition loop. For the first 6 fields, you find the next comma and then
find the CR/LF for the 7th. Use the Mid() function to isolate the field.
In any case, this method will always fail if you have a CR/LF in the
last field of a record.

Pascal

-----Original Message-----
From: list peters [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 2 november 2001 8:56
To: CF-Talk
Subject: csv loop problem


hi,

i am looping over a csv file.
doing this

<cfloop index="newtext" list="#textfile#"
delimiters="#CHR(13)##CHR(10)#">

This works fine for things like
item1,item2

but i get problem for
item1 (line breaks inserted into text), item2

Because of the line breaks in a text block i am getting more than 2
items.

each row is delimited by a CR, however there are CR inside the csv as
text
blocks.

How do i loop over it cleanly.
THere are 7 items per row.

thanks
chad

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
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

Reply via email to