« Return to Thread: iterating loop

Re: iterating loop

by James Holmes-3 :: Rate this Message:

Reply to Author | View in Thread


If it's CF8, a file loop is probably easier to understand than a list
loop with CR/LF delimiters.

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/



2009/7/9 Justin Scott <jscott-lists@...>:

>
>> i have 2 file datatrac.csv,datatrac-ag.csv, action for both
>> the files is same but i have to iterate the loop 2 times
>> based on file name, for that how to check file name
>> which is the file and what is the action(through these 2
>> files i have to insert the data into DB by deleting the
>> previous data)
>
> That's not entirely clear, but it sounds like you need to read in the
> contents of each file and work with them using the same code, but on two
> different files.  If that is correct, then you could have one external loop
> that loops over the filenames, then a CFFILE read to read them, then an
> internal loop to process the contents, such as...
>
> <cfloop list="file1.ext,file2.ext" index="fileName">
>  <cffile action="read" file="#fileName#" variable="contents">
>  <cfloop list="#contents#" index="thisRow" delimiters="#chr(10)##chr(13)#">
>    <!--- Do stuff with the contents --->
>  </cfloop>
> </cfloop>
>
>
> -Justin
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324385
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

 « Return to Thread: iterating loop