Very strange to say, but I suspect the problem in in your source code
structure.  When CF operates on your source code, it doesn't remove
extraneous carriage returns.  Try moving your closing tag up to the end of
the previous line.

Brian

-----Original Message-----
From: Paul Sinclair [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 2:40 PM
To: CF-Talk
Subject: Getting rid of last line return in a cfoutput block


I'm generating a file in comma separated value format from a database query.
I'm using <cffile> to generate a text based csv file (actually I'm running
it through Nate Weiss's filewritetext.cfm custom tag to do the work via
<cffile> but I don't think that matters for purposes of my question).

The problem I've run into is that when I output results using <cfoutput
query="myquery">, it generates an extra line return at the end of the text
file that I created. When I bring the output.csv file into Microsoft Excel,
it comes in with empty records - there are twice as many records as there
actually should be. When I get rid of the trailing line return at the end of
the output.csv file, it opens up fine. I need to figure out how to get rid
of the one extra line return that the <cfoutput> is generating.

The problem is that the <cfoutput> of my query puts in one more line return
than there are records generated by the query. My text file needs to look
like this (putting in line numbers only to clarify that there is an extra
line in the output I am getting):

1. "field1","field2","field3"
2. "1","2","3"
3. "a","b","c"

But it winds up like this:

1. "field1","field2","field3"
2. "1","2","3"
3. "a","b","c"
4.

I need to get rid of the last line in the output.csv file but can't figure
out how to do it. I've used <cfsetting> and the <cf_stripwhitespace> custom
tag but they still leave in the extra line.

Any ideas?

Thanks,
Paul Sinclair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to