Baz wrote:
> You could create a counter:

That's how I generally do it but if you need the count at the beginning 
of the group, or during the output of the group, then your alternative 
would be to pass the query to a UDF that you write whose sole purpose is 
to determine the count of the current group, using a query of queries.

<cffunction name="getGroupCount">
   <cfargument name="qry" type="query" required="yes">
   <cfargument name="fieldName" type="string" required="yes">
   <cfargument name="fieldValue" type="string" required="yes">
   <cfargument name="sqltype" type="string" required="yes">

   <cfquery name="qry2" dbtype="query">
     select count(*) AS CNT
     from qry
     where #fieldname# = <cfqueryparam cfsqltype="#sqltype#" 
value="#fieldValue#">
   </cfquery>
   <cfreturn qry2.CNT>
</cffunction>

Then, in your output, you can just call the UDF to get the record count.

Might have to put some logic around it to only call it once per grouping...

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233705
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to