• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

recordcount within groupby

New Here ,
Sep 21, 2006 Sep 21, 2006

Copy link to clipboard

Copied

I used group attribute within cfoutput tag to group by AType and BType and
tried to get the record count of Btype group there, but I got all record if I use #TEST.recordcount# within the BType group section.
how can I get a recordcount just for BType?

<cfquery name="TEST" datasource="TESTDB">
...............
</cfquery>

<cfoutput query="TEST" group="Atype">
<cfoutput group="Atype">
<cfoutput group="Btype">
<cfoutput>
How many records grouped by Btype? #??????#
</cfoutput>
</cfouput>
</cfouput>
</cfoutput>
TOPICS
Advanced techniques

Views

295

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 21, 2006 Sep 21, 2006

Copy link to clipboard

Copied

There is not automatic ColdFusion feature to get a record count of a
subset of a query. You can build this into your query or your loop. A
simple option for your loop would be this. Modify as needed to count
each inner loop.

<cfquery name="TEST" datasource="TESTDB">
...............
</cfquery>

<cfoutput query="TEST" group="Atype">
<cfoutput group="Atype">
<cfset BtypeCount total = 0>
<cfoutput group="Btype">
<cfset BtypeCount = BtypeCount + 1>
<cfoutput>
</cfoutput>
</cfouput>
</cfouput>
BtypeCount Total is #BtypeCount#
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 21, 2006 Sep 21, 2006

Copy link to clipboard

Copied

LATEST
Use the attached code.

Also note that you do not need (or want) to group by Atype twice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation