Skip to main content
Inspiring
March 12, 2009
Answered

cfsavecontent Situation

  • March 12, 2009
  • 9 replies
  • 3118 views
Hello Community!

I am writing an export and I am using cfsavecontent to save the values of my main query in a variable.

Let's say that I have first_name|last_name|address <This is where I need to break and move to the next line>

I am using #chr(13)#&#chr(10)# inside the cfsavecontent but the enter is being ignored!

Any thoughts?

P.S: Ian and Adam helped out a lot when I was first creating this export file.

Thanks!

Ysais.
This topic has been closed for replies.
Correct answer apocalipsis19
I found something useful in here:
http://www.bennadel.com/index.cfm?dax=blog:1337.view

9 replies

Inspiring
March 12, 2009
Thank you JR and Ian!

I appreciate your time and kindness!

Ysais.
apocalipsis19AuthorCorrect answer
Inspiring
March 12, 2009
Inspiring
March 12, 2009
I'd use the export tools designed for my database rather then CF for creating large files or doing other work with large numbers of records.

For example Microsoft SQL Server includes the "Integration Services" feature for this kind of use.
http://www.microsoft.com/sqlserver/2008/en/us/integration.aspx
Inspiring
March 12, 2009
Ok, guys, so let met change the question.

The generated file is 30 megabytes, 300,000 lines.

I need to ftp it and I got the exception:

'putFile operation exceeded timeout'

Have you run into something similar? I already have this: <cfsetting requesttimeout="532000">

Inspiring
March 12, 2009
apocalipsis19 wrote:
> I just dumped my variable into the browser, you know the variable that contains the data.

I just replied that if you do this, that is how your data is going to
look. HTML by definition ignores line feed and carriage returns.

You need to dump your variable between a set of <pre>...</pre> tags that
tell HTML to *not* ignore these characters OR write the file out and
look at it that way.

Inspiring
March 12, 2009
You are so right JR! I got it!

Thanks Ian and JR!
Inspiring
March 12, 2009
A web browser will usually not display a line break as a line break, it expects a <br> tag instead.

If you save your fileContent variable to a text file using CFFILE and open this file in a text editor does your content look as expected?
Inspiring
March 12, 2009
I just dumped my variable into the browser, you know the variable that contains the data.
Inspiring
March 12, 2009
Please post your code.
Inspiring
March 12, 2009
apocalipsis19 wrote:

>
> Any thoughts?
>
Show some code.

I've never had #chr(13)#&#chr(10)# ignored when they where not supposed
to be ignored.

So without seeing your code, I don't have time to imagine what you could
possible be doing that is so different then the expected way things are
done.

Inspiring
March 12, 2009
Here you go:

<cfsavecontent variable="fileContent">
<cfloop index="idx" from="1" to="#getFields.recordcount#">
<cfoutput> #Trim(getFields.email[idx])#|#Trim(getFields.firstname[idx])#|#Trim(getFields.lastname[idx])#|#Trim(getFields.postalcode[idx])#|#Trim(getFields.campaign[idx])#|#DateFormat(getFields.firstordd[idx],'MM/DD/YYYY')#|#getFields.firstordamt[idx]#|#DateFormat(getFields.lastordd[idx],'MM/DD/YYYY')#|#getFields.lastordamt[idx]#|#getFields.htdordcnt[idx]#|#getFields.htdordtot[idx]#|#getFields.annualordcnt[idx]#|#getFields.annualordtot[idx]##Chr(13)##Chr(10)#
</cfoutput>
</cfloop>
</cfsavecontent>