tracker issue : CF-3041787

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 83613:(Watson Migration Closure)[ANeff] ER for: <cfloop name="" group=""Example:<cfloop query="myQuery" group="myColumn1"> <h1>#myQuery

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 07/17/2010

Components: Language

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 / 2020.0.0.317419

Priority/Frequency: Normal / Unknown

Locale/System: English / Platforms All

Vote Count: 2

Problem:

[ANeff] ER for: <cfloop name="" group=""Example:<cfloop query="myQuery" group="myColumn1">  <h1>#myQuery.CurrentRow# - #myQuery.RecordCount#</h1>  <cfloop name="innerLoop1" group="myColumn2">    <p>#innerLoop1.CurrentRow# - #innerLoop1.RecordCount#</p>    <cfloop name="innerLoop2">      <cfbreak loop="innerLoop1" />    </cfloop>  </cfloop></cfloop>note the following:1) <cfloop name="" (creates struct containing inner CurrentRow and RecordCount)2) <cfbreak loop="" (specifies name of loop to break out of)Just random thoughts.. in case cfloop gets a group attribute.What got me going down this thought trail was that cfoutput/group doesn’t provide a CurrentRow and RecordCount for each inner cfoutput..  only for the outer.  But I wouldn’t further enhance cfoutput/group.. since cfloop is prob better place for this grouping.Related thread: https://prerelease.adobe.com/r/?5e98ce4035e34c67a82b7d728f91ee85
Method:


Result:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3041787

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email: 3D1D17B03C844EBF992001AC
External Test Config: 07/17/2010

Attachments:

Comments:

This bug has been voted..
Vote by External U.
21678 | November 11, 2011 12:47:32 AM GMT
The migration mangled the code. Re-posting.. ----------- <cfloop query="myQuery" name="outerLoop" group="myColumn1"> <cfset outerLoopRecordCount = variables.outerLoop.RecordCount /> <cfset outerLoopCurrentRow = variables.outerLoop.CurrentRow /> <cfloop name="innerLoop1" group="myColumn2"> <cfset innerLoop1RecordCount = variables.innerLoop1.RecordCount /> <cfset innerLoop1CurrentRow = variables.innerLoop1.CurrentRow /> <cfloop name="innerLoop2"> <cfif something neq "something else"> <cfbreak loop="innerLoop1" /> </cfif> </cfloop> </cfloop> </cfloop> ----------- This does the following: 1) Creates these variables: - outerLoop.CurrentRow - outerLoop.RecordCount - innerLoop1.CurrentRow - innerLoop1.RecordCount - innerLoop2.CurrentRow - innerLoop2.RecordCount 2) Enables <cfbreak loop="loopNameHere" /> to break out to a specific loop.
Comment by External U.
21670 | May 21, 2012 08:22:23 PM GMT
Basically this ER is to add a 'name' attribute to cfloop (for query loops) and a 'loop' attribute to cfbreak.
Comment by External U.
21671 | May 21, 2012 08:27:13 PM GMT
This bug has been voted..
Vote by External U.
21679 | May 21, 2012 08:35:20 PM GMT
For dynamic query loops, the 1st line of my example could be: <cfloop query="#getData()#" name="outerLoop" group="myColumn1"> This would permit the scoping of a loop's dynamic queries. Example: If getData() returns a query containing a "foo" column, then this would permit scoping of that query column as: "outerLoop.foo".
Comment by External U.
21672 | June 07, 2012 03:03:45 PM GMT
This ER is for 3 enhancements to _child_ _query_ loops: 1) <cfloop name="myLoop" 2) #myLoop.RecordCount# & #myLoop.CurrentRow# 3) <cfbreak loop="myLoop" Why was this ticket marked Closed/Fixed? None of the above have been implemented. So can this ER please be re-opened? I'll re-explain w/ this example: <cfquery name="q" datasource="cfartgallery"> SELECT * FROM art WHERE artID <= 10 ORDER BY isSold,mediaID </cfquery> <cfloop query="q" group="isSold"> <cfoutput><p>#q.CurrentRow# of #q.RecordCount#</p></cfoutput> <cfloop group="mediaID" name="myLoop"><!--- enhancement #1 ---> <cfoutput>#myLoop.CurrentRow# of #myLoop.RecordCount#<br /></cfoutput><!--- enhancement #2 ---> <cfloop> <cfbreak loop="myLoop" /><!--- enhancement #3 ---> </cfloop> </cfloop> <!--- The <cfbreak loop="myLoop" /> breaks out of the "myLoop" loop and causes execution to continue on this line ---> </cfloop> In summary, by naming a child query loop, we can: 1) break out of it within any descendant loop (<cfbreak loop="myLoop" />) 2) output the total # of rows in the query subset* (#myLoop.RecordCount#) 3) output the current row # within the query subset* (#myLoop.CurrentRow#) * - by "query subset", I mean the slice of the query that the child loop is dealing with Thanks!, -Aaron
Comment by External U.
21673 | May 06, 2014 04:22:19 AM GMT
Hi Himavanth, Can you please re-open this ER? It was never fixed. Then I can attach use case code examples. Thanks!, -Aaron
Comment by External U.
21674 | September 15, 2014 06:49:46 PM GMT
*bump* This was never fixed at all. Not even slightly. This ER was _not_ for <cfloop group="">, but rather is an extension to that feature. Please re-open. Thanks!, -Aaron
Comment by External U.
21675 | November 24, 2014 04:52:13 AM GMT
3) <cfbreak loop="myLoop" should be: 3) <cfbreak loop="myLoop" and <cfcontinue loop="myLoop" (I'd forgotten about cfcontinue, which was added in the release prior to me filing this ticket)
Comment by External U.
21676 | August 27, 2016 10:07:09 AM GMT
Glad to see this is "To Fix". Long-awaited and anticipated :) Thanks!, -Aaron
Comment by Aaron N.
21677 | August 02, 2017 03:11:07 AM GMT
Hi Adobe, I see Lucee added a 'label' attribute to cfloop/cfbreak/cfcontinue. And that attribute name would be fine. BUT, please also ensure that cfloop's label="myLabel" (for example) creates a struct named myLabel containing CurrentRow & RecordCount keys, for referencing _that_ query loop's CurrentRow/RecordCount. Currently, it is only possible to reference the CurrentRow/RecordCount of the outermost query loop. But those values are meaningless when inside a child loop and needing to output the child loop's CurrentRow/RecordCount. Just realized I filed this ticket nearly 8 years ago. I hope it sees the light of day. I'm sad to see Lucee implemented it first. Please consider! Thanks!, -Aaron
Comment by Aaron N.
26415 | March 28, 2018 05:10:18 AM GMT