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.
You could do an output before to get the count. This would be more efficient than doing a query of queries.
<cfoutput query="resources" group="type">
<cfset noofrecords= 0>
<cfoutput>
<cfset noofrecords++>
</cfoutput>
<h4>#type# (#noofrecords# of #resources.recordcount#)</h4>
<cfoutput>
#name#
</cfoutput>
</cfoutput>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With