House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Group by??

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Phillip Vector
10/03/2012 04:13 PM

So I have a query that returns the following.. Client_Code     MenuName     Client_Name 4938               Test           Test Company 9328               Test           Test Company 10349              Test           Test Company 9283               Test           Test 2 Company What I'm trying to do is produce a table for MenuName        Client_Name         Client_Code Test              Test Company       4938,9328,10349 Test              Test 2 Company     9283 So far, I have this..     <cfoutput query="currentQuery" group="Client_Code">       <tr>       <cfloop list="#event.getArg("displayList")#" index="currentField">         <td>           #currentQuery[currentField][currentQuery.currentRow]#         </td>       </cfloop>       </tr>     </cfoutput> Which is showing each client_code on a seperate line.. Can someone tell me what I'm doing wrong here?  

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
10/03/2012 04:27 PM

----- Excess quoted text cut - see Original Post for more ----- Whenever you use the GROUP attribute of CFOUTPUT, you use a nested CFOUTPUT to display the members of each group. So, you'd need something like this: <cfoutput query="..." group="Client_Name">      <tr>           <td>#MenuName#</td>           <td>#Client_Name#</td>           <td>                <cfoutput>#Client_Code#,</cfoutput> <!--- this will actually leave an extra comma at the end, there are various ways to avoid that or remove it --->           </td>      </tr> </cfoutput> Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Phillip Vector
10/03/2012 04:33 PM

Hrm.. Still getting the same result. The code that is actually printing it is #currentQuery[currentField][currentQuery.currentRow]# So I probably have to figure out how to remove the current row (since #currentQuery[currentField]# doesn't work). It's probably forcing it to display just on that row. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Leigh
10/03/2012 04:47 PM

> group="Client_Code"> It should work as long as its contained without a nested cfoutput as Dave mentioned. Also, notice he is grouping by "Client_Name" instead of the code.  Be sure the query results are sorted by that column too. -Leigh

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Phillip Vector
10/03/2012 04:52 PM

*facepalms* That did it. I wasn't sorting the query by Client_Name. I was doing it by Client_Code. Thanks guys. I appricate the help. :) ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference