Skip to main content
Inspiring
July 17, 2007
Question

cffile: reading over file

  • July 17, 2007
  • 1 reply
  • 261 views
Hi all,

I am trying to figure out the best way to read over a file and stuff the contents into a database.

The file contains three line blocks of customer data.

I need to create a loop and create a condition where it reads the first three lines, then stuffs the parsed line items info into the database table, then the second group of three lines...etc.

How would I approach this.

I already have the cffile read part figured out now how would I loop over the 3 line condition and stuff database with parsed info?

I am also using Coldfusion 8 so I can do a cfloop over the cffile read variable as a query, because I believe the cffile variable can be treated this way...but I could be misinformed or approaching the problem wrong.
This topic has been closed for replies.

1 reply

July 17, 2007
What is the character that terminates each line? If we assume ASCII 10, then you could read the entire file in and treat it as a list delimited by Chr(10). See concept code below.