Here the other couple answers, just for fun :), although having a counter is probably the best way, since you are already facing a performance hit when using a loop.
<cfquery name="getCount" dbtype="query"> SELECT PROCESS_ID FROM get_serial WHERE PROCESS_ID = #attributes.action_id# </cfquery> <cfset total = getCount.RecordCount />
And using lists is always fun:
<cfset total = ListValueCount(ValueList(get_serial.PROCESS_ID), attributes.action_id) />
The point is that there are many ways to solve this problem, so have fun :)
source share