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

Is there a 'lookahead' when using the GROUP attribute of CFOUTPUT?

LEGEND ,
Sep 06, 2017 Sep 06, 2017

Copy link to clipboard

Copied

Hello, all,

I was just wondering if there is a native lookahead when using the GROUP attribute of CFOUTPUT to determine things like how many records are in the group?

For example, let's say I had a query like so:

CATEGORY                      SPEC                 ROLE

CAT I                         SPEC I               ROLE I

CAT I                         SPEC I               ROLE II

CAT I                         SPEC I               ROLE III

CAT I                         SPEC II              ROLE Ia

CAT I                         SPEC II              ROLE IIa

CAT I                         SPEC III             ROLE Ib

CAT II                        SPEC IV              ROLE Ic

CAT II                        SPEC IV              ROLE Id

CAT II                        SPEC V               ROLE Ie

CAT III                       SPEC VI              ROLE If

CAT III                       SPEC VI              ROLE Ig

In my CFOUTPUT, I give the first tag both the query name and the group="CATEGORY"; the second CFOUTPUT will just have group="SPEC"; the third CFOUTPUT has no attributes.

Is there a way that I can tell ahead of time that CAT I, SPEC I has three records (ROLE I, II, and III)?

V/r,

^ _ ^

Views

248

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

correct answers 1 Correct answer

LEGEND , Sep 06, 2017 Sep 06, 2017

Apparently, no.

However, I did find a thread on SO that had a nice workaround.  (Granted, maybe not so nice if you're grabbing 1,000,000+ records.)

<cfoutput query="foo" group="CATEGORY">

    #category#

    <cfoutput group="SPEC">

          <br />#spec#

          <cfset numrecs = 0 /><cfoutput><cfset numrecs++ /></cfoutput>

          <br />#numrecs# records:<br />

          <cfoutput><br />#ROLE#</cfoutput><br /><br />

     </cfoutput>

</cfoutput>

Hope this helps anyone else seeking something like this.

V/r

...

Votes

Translate

Translate
LEGEND ,
Sep 06, 2017 Sep 06, 2017

Copy link to clipboard

Copied

LATEST

Apparently, no.

However, I did find a thread on SO that had a nice workaround.  (Granted, maybe not so nice if you're grabbing 1,000,000+ records.)

<cfoutput query="foo" group="CATEGORY">

    #category#

    <cfoutput group="SPEC">

          <br />#spec#

          <cfset numrecs = 0 /><cfoutput><cfset numrecs++ /></cfoutput>

          <br />#numrecs# records:<br />

          <cfoutput><br />#ROLE#</cfoutput><br /><br />

     </cfoutput>

</cfoutput>

Hope this helps anyone else seeking something like this.

V/r,

^ _ ^

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