Search code examples
coldfusioncoldfusion-10cfloopcfoutput

How to find the nested cfoutput recordcount when using group


Consider the following:

<cfoutput query="resources" group="type">
    <h4>#type#</h4>
       <cfoutput>
          #name#
       </cfoutput>
 </cfoutput>

resources.recordcount would give me the total number of records, but is there an elegant way of finding out the recordcount of the nested data? e.g

<cfoutput query="resources" group="type">
    <h4>#type# (#noofrecords# of #resources.recordcount#)</h4>
       <cfoutput>
          #name#
       </cfoutput>
 </cfoutput>

I could probably do something hacky with loops, but wondered if there was a way of doing it using the cfoutput groups specifically.


Solution

  • I am afraid that you would have to do some counting yourself. There is no RecordCount for the nested grouped output, because it is really all the same query, CF is just doing a little formatting for you.