scripter73
Programmer
Hi,
I have a query that returns my resultset in the Excel application. The only problem is every data element is put on another row instead of in another column of the same row for every currentrow.
Can anyone notice what I'm doing wrong? Thanks in advance for any suggestions.
Change Your Thinking, Change Your Life.
I have a query that returns my resultset in the Excel application. The only problem is every data element is put on another row instead of in another column of the same row for every currentrow.
Code:
<cfquery name="get_custs" datasource="customers" maxrows=20>
select
custid,
contactid,
custname_contact,
firstname,
lastname,
title,
workphone,
address,
email,
city,
state,
zip
from contacts_cust
</cfquery>
<!--- Open Data in Excel --->
<cfif get_custs.recordcount gt 0>
<cfheader name="content-disposition" value="attachment;filename=testexcel#DateFormat(Now(),"YYYYMMDD")#.xls">
<cfcontent type="application/msexcel" reset="yes">
<cfset ColumnArray = ListToArray(get_custs.columnlist)>
<cfoutput query="get_custs">
[COLOR=red]All of this should return on same Excel row[/color]
#get_custs.currentrow# --
<cfloop index="i" from="1"
to="#ArrayLen(ColumnArray)#">
#evaluate("get_custs."&ColumnArray[i])#
</cfloop><br />
</cfoutput>
</cfif>
Can anyone notice what I'm doing wrong? Thanks in advance for any suggestions.
Change Your Thinking, Change Your Life.