Skip to main content
Participant
February 24, 2010
Question

I want to create a crosstab type query

  • February 24, 2010
  • 1 reply
  • 783 views

I'm trying to output a table something like this below.


Product_1Product_2
Characteristic_1 i.e. length1020
Characteristic_2 i.e. diameter515

How do I do this? My current code creates the table below.  You can see Product drops down rather than across and the product characteristics repeat which I don't want.  Please help.

Test Product 1
Where UsedWU test
Maximum Flow Rate
(UV dose >30,000 µWs/cm2)*
Max flow test
Inlet/Outlet Size (inch NPT)I/O test
Lamp Power (watts)Lamp test
Chamber Size
Diameter X Length (inch/mm)
Chamber test
Test Product 2
Where UsedWU test 2
Maximum Flow Rate
(UV dose >30,000 µWs/cm2)*
MF test 2
Inlet/Outlet Size (inch NPT)I/O size test 2
Lamp Power (watts)lamp power test 2
Chamber Size
Diameter X Length (inch/mm)
chamber size test 2

    This topic has been closed for replies.

    1 reply

    Inspiring
    February 24, 2010

    Order your query by characteristic, then product.  Then use the group attribute of cfoutput.

    barnboydAuthor
    Participant
    February 24, 2010

    Here's my code.  Could you help me understand in correcting this?

    <table width="580" border="1">

       <cfoutput query="qWaterMatrix" group="product_Name">

      <tr>

        <th scope="col"></th>

        <th align="center" scope="col">#qWaterMatrix.product_Name#</th>

      </tr>

      <tr>

        <th align="left" scope="row">Where Used</th>

        <td>#qWaterMatrix.where_Used#</td>

      </tr>

      <tr>

        <th align="left" scope="row">Maximum Flow Rate<br />

          (UV dose &gt;30,000 µWs/cm2)*</th>

        <td>#qWaterMatrix.max_Flow#</td>

        </tr>

      <tr>

        <th align="left" scope="row">Inlet/Outlet Size (inch NPT)</th>

        <td>#qWaterMatrix.conn_Size#</td>

      </tr>

      <tr>

        <th align="left" scope="row">Lamp Power (watts)</th>

        <td>#qWaterMatrix.lamp_Watts#</td>

      </tr>

      <tr>

        <th align="left" scope="row">Chamber Size<br />

          Diameter X Length (inch/mm)</th>

        <td>#qWaterMatrix.chamber_Size#</td>

      </tr>

       </cfoutput>

      </table>

    Inspiring
    February 24, 2010

    The group attribute works like this:

    <cfoutput query="yourquery" group="somefield">

    #grouped data#

    <cfoutput>

    #ungrouped data#

    </cfoutput>

    </cfoutput>

    Your code only has the grouped data outputting.