How do you implement a "CFOUTPUT Group" scenario when you need to give the user
the option of displaying the results by different sorting orders?
I'm displaying a list of buildings, some of which have multiple managers. I allow the
user to click on any column to indicate how they'd like the results sorted. The
desired
order is stored in Attributes.Order.
My SQL looks like this:
<CFQUERY NAME="ListBuildings" DATASOURCE="#datasource#">
SELECT a.*, b.ManagerID, c.FirstName, c.LastName
FROM Buildings a, BuildingManagers b, Users c
WHERE a.CustomerID=#Session.CustomerID#
AND b.BuildingID=a.ID
AND c.UserNumber=b.ManagerID
ORDER BY #Attributes.Order#
</CFQUERY>
To avoid displaying the duplicate building records in the case of multiple managers, I
use this:
<CFOUTPUT QUERY="ListBuildings" GROUP="ID"><!--- ID is the building ID --->
#ListBuildings.BuildingName#
<CFOUTPUT>#ListBuildings.FirstName# #ListBuildings.LastName#</CFOUTPUT>
<!--- Nested CFOUTPUT displays one or more building managers--->
</CFOUTPUT>
This works fine only when the sort order is by ID (building). What must I add to make
it
work for other sort orders?
Gene Kraybill
---------------------------------
Gene Kraybill
LPW & Associates LLC
www.lpw.net
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.