Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No output displayed in excel

Status
Not open for further replies.

gatsrulz

MIS
Sep 2, 2004
60
Nothing gets written into the excel file. Not even the titles. Please assist

My code is as follows

<html>
<head>
<title>Forum Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<cfquery name=MQuery >
select * from Forummembers where Fid = #url.id# and datediff(day, dateofexpiry, getdate()) < -7
</cfquery>
<cfif MQuery.recordcount GT 66000>
Too many records
<cfelse>
<cfset parlist = "">
<cfset titlist = "">
<cfset titlist = listappend(titlist, "Name" & " ")>
<cfset titlist = listappend(titlist, "Address" & " ")>
<cfset titlist = listappend(titlist, "City" & " ")>
<cfset titlist = listappend(titlist, "State" & " ")>
<cfset titlist = listappend(titlist, "Zip" & " ")>
<cfset titlist = listappend(titlist, "E-Mail" & " ")>
<cfset parlist = listappend(parlist, titlist, "")>

<cfoutput query="MQuery">
<cfset kidlist = "">
<cfset kidlist = listappend(kidlist, trim(name) & "")>
<cfset kidlist = listappend(kidlist, trim(address) & "")>
<cfset kidlist = listappend(kidlist, trim(city) & "")>
<cfset kidlist = listappend(kidlist, trim(state) & "")>
<cfset kidlist = listappend(kidlist, trim(zip) & "")>
<cfset kidlist = listappend(kidlist, trim(email) & "")>
<cfset parlist = listappend(parlist, kidlist, "")>
</cfoutput>

<cffile action="write" file="#expandpath('.')#\Lapse.csv" output="#parlist#" addnewline="no">

<div align="center">
<p><font face="verdana, sans-
serif" size="2"> <strong>Lapsed Member list generated...<br>
<a href="Laspe.csv" target="_blank">Click here to complete the download</a> </strong></font></p>

</div>
</cfif>

</body>
</html>
 
Code:
<cfoutput query="MQuery">
<cfset kidlist = "">
you clear "kidList" each time the loop runs. put <cfset kidlist = ""> above the <cfoutput> tag.

you're also using "" as a delimiter... i don't think you can do that. try "," or something crazy like "^"



Beware of programmers who carry screwdrivers.
 
Still does not work... Does not even write the titlist output to the file. :-( am kinda stumped!
 
well either MQuery.recordcount GT 66000 or you're not looking at the right file.

do this and make sure it's writing to the file you're looking at.

<cfoutput>
#expandpath('.')#\Lapse.csv
</cfoutput>

Beware of programmers who carry screwdrivers.
 
also lets take a look at some other things.

first
Code:
<cfset titlist = "">
<cfset titlist = listappend(titlist, "Name" & " ")>
<cfset titlist = listappend(titlist, "Address" & " ")>
<cfset titlist = listappend(titlist, "City" & " ")>
<cfset titlist = listappend(titlist, "State" & " ")>
<cfset titlist = listappend(titlist, "Zip" & " ")>
<cfset titlist = listappend(titlist, "E-Mail" & " ")>
<cfset parlist = listappend(parlist, titlist, "")>
why use all the cfsets? better practice to use one set.
<cfset titleList = "Name ,Address ,City ,State ,Zip E-Mail ">

also you're appending an empty space before the default delim (comma) so the way i set "titleList" is the same thing you're doing. then your last line you specify "" as your delim which is now a space so your titles will not have a comma between the last and second to last title.

yoru line
Code:
<cfset kidlist = listappend(kidlist, trim(name) & "")>
and all that follow it adds an empty string to the end of the value. no value in doing this and adds extra work to your process.

no point in using the list append functions at all really...
watch...
Code:
<cfset newline = #chr(13)#&#chr(10)#>
<cfset pageOutput = "Name,Address,City,State,Zip,E-Mail"&newLine>
<cfoutput query = "mQuery">
<cfset pageOutput = mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>
</cfoutput>
<cffile action="write" file="#expandpath('.')#\Lapse.csv" output="#pageOutput#" addnewline="no">

Beware of programmers who carry screwdrivers.
 
oops

Code:
<cfset newline = #chr(13)#&#chr(10)#>
<cfset pageOutput = "Name,Address,City,State,Zip,E-Mail"&newLine>
<cfoutput query = "mQuery">
<cfset pageOutput = [b]pageOutput & [/b]mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>
</cfoutput>
<cffile action="write" file="#expandpath('.')#\Lapse.csv" output="#pageOutput#" addnewline="no">

Beware of programmers who carry screwdrivers.
 
It worked.... but only the last record gets outputted to the file......
 
addnewline="no">

Are you not overwriting the file each time you spin through the output?

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'm not as think as you confused I am.
-----------
Flabbergasted (a.): Amazed at how much weight one has gained.
-----------
Oyster (n.): One who sprinkles their conversation with Yiddish expressions.
 
Tried this.... but still only the last record is being displayed

<cfset newline = #chr(13)#&#chr(10)#>
<cfset pageOutput = "Last Name,First Name,Address,City,State,Zip,E-Mail"&newLine>
<cffile action="write" file="D:\Webs\ output="#pageOutput#" addnewline="no">
<cfoutput query = "mQuery">
<cfset pageOutput = mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>
<cffile action="append" file="D:\Webs\ output="#pageOutput#" addnewline="no">
</cfoutput>
 
<cfset pageOutput = mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>


should read

<cfset pageOutput = pageOutput & mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>


that was the whole point of my "oops" post.

Beware of programmers who carry screwdrivers.
 
try this again.... not using the action = "append"

Code:
<cfset newline = #chr(13)#&#chr(10)#>
<cfset pageOutput = "Name,Address,City,State,Zip,E-Mail"&newLine>
<cfoutput query = "mQuery">
<cfset pageOutput = [b][COLOR=red]pageOutput & [/color][/b]mQuery.Name & "," & mQuery.Address & "," & mQuery.City & "," & mQuery.State & "," & mQuery.zip & "," & mQuery.email & newLine>
</cfoutput>
<cffile action="write" file="#expandpath('.')#\Lapse.csv" output="#pageOutput#" addnewline="no">

Beware of programmers who carry screwdrivers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top