<cfset str = "Start of the string, "> <cfset str = str & " middle bit,"> <cfset str = str & " end bit.">
<cfoutput>#str#</cfoutput> Is that ok? Ade -----Original Message----- From: Scot VanAlstine [mailto:[EMAIL PROTECTED] Sent: 28 February 2005 14:41 To: CF-Newbie Subject: output loop results to a variable OK. I have it looping and parsing my log file. Its outputting to the screen perfectly. Now I need to get it to write the screen contents ot a file. I know I need to have each line written to a variable at the end of the loop but how do I set up a variable that append it's self? (The write state was used because there are multiline records. This keeps the record together) Here is my code: <body> <cffile action="Read" file="D:/Inetpub/Var/wirez/www.wirez.com/website/testserver/TRAIN09.log" variable="str_Content"> <cfset bln_FirstLine = true> <!--- default var ---> <cfset New_File = ""> <!--- Loop through the lines---> <cfset write_state = false> <cfloop list="#str_Content#" delimiters="#chr(13)##chr(10)#" index="str_Line"> <!--- Set line as an array---> <cfset Content_array = #ListtoArray(str_Line)#> <!--- trim line down to just date---> <cfset record_string = Left((Content_array[1]), 10)> <!---Verifying to see if first 10 characters are a date---> <cfif IsDate(#record_string#)> <!---Setting variables for todays date and the date in the string---> <cfset todays_date = DateFormat(Now(),'mm/dd/yyyy')> <cfset record_date = DateFormat(#record_string#,"mm/dd/yyyy")> <!---Computing the difference between the two dates in days---> <cfset datediff = DateDiff("d",#record_date#,#todays_date#)> <!---If the difference between the two dates in days is greater than 31 we will set the "write_state" variable to true and output the "str_Line" variable---> <cfif #DateDiff# Gte 31> <CFSet write_state = True> <cfoutput><br>#str_Line# <br></cfoutput> <cfelse> <cfset write_state = False> </cfif> <cfelse> <!---If the previous "write_state" variable above was set to true AND this next line is not a date then it will output the "str_Line" variable as the second line of the record with spaces to indent it---> <cfif #write_state# is true> <cfoutput> #str_Line# <br></cfoutput> </cfif> </cfif> <!---Here is my feeble attempt to make the output variable---> <cfset full_file = #str_Line#> </cfloop> <!--- Write the file back - destination D:/vars/wirez... ---> <cffile action="write" nameconflict="overwrite" destination="D:/Inetpub/Var/wirez/www.wirez.com/website/testserver/" mode="777" file="D:/Inetpub/Var/wirez/www.wirez.com/website/testserver/TRAIN12.log" output="#full_file#"> </body> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:693 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
