Highlighted

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

LEGEND ,
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,

^ _ ^

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,

^ _ ^

Views

128

Likes

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

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

LEGEND ,
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,

^ _ ^

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,

^ _ ^

Views

129

Likes

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
Sep 06, 2017 0
LEGEND ,
Sep 06, 2017

Copy link to clipboard

Copied

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,

^ _ ^

Likes

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
Reply
Loading...
Sep 06, 2017 0