Skip to main content
Inspiring
November 6, 2009
Question

How can I output this differently ?

  • November 6, 2009
  • 1 reply
  • 978 views

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..

This topic has been closed for replies.

1 reply

Inspiring
November 6, 2009

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>

trojnfnAuthor
Inspiring
November 6, 2009

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

Inspiring
November 6, 2009

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>