Skip to main content
June 1, 2012
Question

Fixed Column Number CSV variable? How to parse

  • June 1, 2012
  • 1 reply
  • 410 views

I have the following variable that is a result of a cfexecute that I would like to populate into a database. There doesn't appear to be a Line Feed but there are only three columns. My question is how can I accomplish parsing the 1st value as Column 1, 2nd value as Column 2, 3rd as column 3 and 4th as column 1, 5th as column two.... etc.

Thank you,

This topic has been closed for replies.

1 reply

Inspiring
June 1, 2012

That dump looks like it came from BlueDragon, not from ColdFusion?

But anyway, what makes you say there's no line feeds?  If it's based on looking at a <cfdump> result you won't be able to tell because a LF character (ie: chr(10)) does not not render as a line break in a browser,it'll just render as a whitespace character.  It certainly looks to me like there's a whitespace character between each notional row of data in your CSV there.

I think you should verify what the data actually contains before trying any specific solution here.

That said, it's easy enough to have a loop that increments by three each time, and taking the index as the first column, and the index+1 and index+2 as the second on third columns, treating the string as a comma-delimited list.

--
Adam