|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Need advice about CFFile
I am tasked with pulling a text file into a CF program. I am assuming CFFILE is the best method for doing this. But this file contains many rows of records. It pulls in the data so far, but it comes in as one huge chunk of data. What I need to do is be able to separate those rows and perform actions with individual fields in those rows such as summarizations.
Due to a time constraint any help would be appreciated. Thanks. |
|
#2
|
|||
|
|||
|
Assuming each line ends with a carriage return and line feed, just treat the text as a list with a delimiter of carraige return and line feed. Now you can loop over the list and each list element will be one row of the text file.
|
|
#3
|
|||
|
|||
|
Wow! That was a quick response. Could you provide some pseudo code or some example code? Thanks.
Last edited by dt2003 : March 11th, 2004 at 09:00 AM. |
|
#4
|
|||
|
|||
|
<cffile action="READ" file="#expandPath( someFile )#" variable="textFile">
<cfloop index="thisRow" list="#TextFile#" delimiters="#chr(13)##chr(10)#"> ...do whatever you need to do on each row... </cfloop> |
|
#5
|
|||
|
|||
|
Quote:
Thanks. I am not sure I understand the use of "#chr(13)##chr(10)#" as a delimiter. Can use please explain? Thanks. |
|
#6
|
|||
|
|||
|
It's the ascii characters for a carriage return and a line feed, and is how most text documents denote the end of a line and the start of a new one.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Need advice about CFFile |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|