Skip to main content
Known Participant
April 9, 2012
Answered

Query results display help

  • April 9, 2012
  • 2 replies
  • 980 views

Hello

I'm having a issue with displaying the results of my query output.

When I cfloop over the results.. the part number is being output on 3 different rows... when I want it on one row querying multiple tables.. and you cant use the group option with the cfloop

here is the query

  

<cfquery datasource="wire" name="testss3">
   SELECT a.part AS pparts, a.wireid AS wireidA, a.strnds, a.wt, a.sps1, a.sps2, a.sps3, a.tin, b.slookup AS lid, b.wireid AS wireidB, b.reelid AS reelnmbr, d.reelid AS rlid, d.rname, d.rsku, d.rcost, e.plookupid, e.prctid, e.wireid AS wireidE, f.prctid, f.percentage, g.rsize
   FROM Mpart a, slookupt b, reeltbl d, prctlup e, prct f, spoolsize g
   WHERE a.wireid = b.wireid AND e.prctid = f.prctid AND a.wireid = e.wireid AND b.reelid = d.reelid AND g.spoolSizeid = b.spoolSizeid
   </cfquery>

<table border="1" border="1">
<tr>
        <td></td>
        <td bgcolor="#CCCCCC" class="style23">Part No.  </td>
        <td bgcolor="#CCCCCC" class="style23">Wt./Mft.</td>
        <td bgcolor="#CCCCCC" class="style23" colspan="3">Spool Sizes (Cost/ft.)</td>
        <td> </td>
      </tr>
             
   <cfloop query="testss3"><cfoutput>
     <tr>
        <td></td>
           <td align="left" class="style23">#pparts# @</td>
            <td align="left" class="style23">#wt#</td>
           <td align="left" class="style23">
            #rsize# #rcost#  #wireidA#</cfoutput></cfloop></td>
        <td> </td>
       </tr>      
</table>

Part No.  Wt./Mft.Stock Spool Sizes (Cost/ft.)
10 sol @31.431000 2.8000 1 
10 sol @31.432500 5.9800 1 
10 sol @31.435000 7.3000 1 
10T @31.431000 2.8000 2 
10T @31.432500 5.9800 2 
10T @31.435000 7.3000 2 
8 sol @50500 2.8000 4 
8 sol @501000 5.9800 4 
8 sol @505000 7.3000 4 
8T @50500 2.8000 5 
8T @501000 5.9800 5 
8T @505000 7.3000 5

the first row should read 10 sol | 31.43 | 1000 | 2500 | 5000

the next row 10T | 31.43 | 1000 | 2500 | 5000

Any help would be much appreciated!

Thanks!

    This topic has been closed for replies.
    Correct answer JMF3

    You have to nest CFOUTPUT tags to use GROUP the way you want to. An

    outside loop to get the "one row only" and an interior one to get all the

    subdetails within that row:

    roughly

    2 replies

    Known Participant
    April 9, 2012

    Hello..

    Sorry.. another problem came up..

    I have a math formula that needs to be run every time I go through 1 of the 3 columns to figure a cost... when I do cfoutput its outputting the same number ..

    Any ideas?

    Thanks for your input!

    Known Participant
    April 9, 2012

    Ahhh!... I think I got it!

    I moved my variables within the cfoutput tags!

    Inspiring
    April 9, 2012

    Since you know about the group attribute, why not use the tag that has it?

    Known Participant
    April 9, 2012

    Hi Dan

    When i use the cfouput with the group attribute... the query only returns one of the columns from the table for stock spool sizes...

    so the new query results will have 1 part which is good 10 Sol | 31.43 | 1000

    but only 1000 .. when it should return 1000 | 2500 | 5000  based on that wireid

    Thanks

    JMF3Correct answer
    Participating Frequently
    April 9, 2012

    You have to nest CFOUTPUT tags to use GROUP the way you want to. An

    outside loop to get the "one row only" and an interior one to get all the

    subdetails within that row:

    roughly