Copy link to clipboard
Copied
I currently output my report in a table using the following :
<table width="760" border="1" bordercolor="black" cellspacing="0" cellpadding="2">
<tr bgcolor="#DCDEE0">
<td class="TitleText" align="center"><b>Month/Year</b></font></td>
<td class="TitleText" align="center"><b>Total Lots In</b></font></td>
<td class="TitleText" align="center"><b>Total Lots Out</b></font></td>
</tr>
<cfoutput query="qryGetData">
<tr>
<td class="TitleText" align="center">#month_status#</td>
<td class="TitleText" align="center">#totalLotsIn#</td>
<td class="TitleText" align="center">#totalLotsout#</td>
</tr>
</cfoutput>
</table>
The outout looks something like this :
Month/Year Total Lots In Total Lots Out
1/09 10 20
2/09 30 30
etc...
How can I change the table to make the output look something like this :
1/09 2/09 3/09
In Out In Out In Out
10 20 30 30 40 50
etc..
Copy link to clipboard
Copied
Something like this
<cfoutput>
<tr>
<cfloop query = "yourquery">
<td colspan = "2">#month_status#</td>
</cfloop>
</tr>
d
<cfloop query = "yourquery">
<td>in</td><td>out</td>
</cfloop>
</tr>
<tr>
<cfloop query = "yourquery">
<td>#totallotsin#</td>
<td>#totallotsout#</td>
</cfloop>
</tr>
</cfoutput>
Copy link to clipboard
Copied
Dan, your solution works exactly as I requested.
However, the requirements just changed and the output needs to look like this :
Category 11/08 12/08 1/09 2/09.....etc.......Total
Lots In 10 10 30 29.................79
Lots Out 23 10 20 30.................83
I tried to modify your code by taking out the second cfloop but still cannot get it to display in this format.
Can you show me what needs to be done ?
Thanks
Copy link to clipboard
Copied
I'll do lotsin, you do the other two
<tr>
<td>Lots In></td>
<cfloop query="yourquery">
<td>#lotsin#</td>
</cfloop>
<td>#arraysum(yourquery["lotsin"])#</td>
</tr>
Copy link to clipboard
Copied
That worked great , but how do you get the repeat region to work, Also whats this command for <td>#arraysum(yourquery["lotsin"])#</td>
I get the record to show right just will not repeat correclty with repeat region... It's all vertical
Copy link to clipboard
Copied
Each column of a cold fusion query object is effectively a 1 dimensional array. As such, you can use array functions with them. That specific one gives the person who asked the question the total he was seeking.
I don't know what Repeat Regions are so I can't help you there.