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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab output in CF

Status
Not open for further replies.

CTR

Technical User
Nov 15, 2001
42
US
Hi, This is my first try at displaying crosstab results. I'm almost done. I have the columns and rows properly labeled and displayed. Now I just need to fill the cells with the data.

The last part with the ## near the end is where I will display the value. It sould be a count of SpecPK, but I can't get CF to allow it.

Here is what I have so far:

<cfquery Name=&quot;CrossSpec&quot; Datasource=&quot;JVBB&quot;>
TRANSFORM Count(SpecPK) AS CountOfSpecPK
SELECT ReasonforDiscard
FROM UnacceptableSpecimens
GROUP BY ReasonforDiscard
PIVOT Format([SDate], 'yyyy')
</cfquery>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

<cfset list_services = ListDeleteAt(CrossSpec.ColumnList, ListFindNoCase(CrossSpec.ColumnList, &quot;ReasonforDiscard&quot;)) >


<table border=&quot;1&quot; cellspacing=&quot;0&quot;>
<!---- output column headers ----->
<tr>
<td><b><font size=&quot;3&quot; color=&quot;#990000&quot;>Reason for Discard</font></b></td>
<cfloop list=&quot;#list_services#&quot; index=&quot;Col&quot;>
<td><b><font size=&quot;3&quot; color=&quot;#990000&quot;><cfoutput>#Col#</cfoutput></font></b></td>
</cfloop>
</tr>
<cfoutput query=&quot;CrossSpec&quot;>
<tr>
<td>#ReasonforDiscard#</td>
<cfloop list=&quot;#list_services#&quot; index=&quot;Col&quot;>
<td>##</td>
</cfloop>
</tr>
</cfoutput>
</table>
_____________

Cliff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top