|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Group by??
So I have a query that returns the following..Phillip Vector 10/03/12 04:13 P > So I have a query that returns the following..Dave Watts 10/03/12 04:27 P Hrm.. Still getting the same result.Phillip Vector 10/03/12 04:33 P > group="Client_Code">Leigh 10/03/12 04:47 P *facepalms* That did it. I wasn't sorting the query by Client_Name. I was doing it by Client_Code.Phillip Vector 10/03/12 04:52 P 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? ----- 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. 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 ----- > 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 *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 -----
|
May 24, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||