Title:
Bug 75191:(Watson Migration Closure)adding two reserved variables currentRow and recordCount to cfloop array
| View in TrackerStatus/Resolution/Reason: Closed/Deferred/
Reporter/Name(from Bugbase): Nuri Cevik / Nuri Cevik (Nuri Cevik)
Created: 01/23/2009
Components: Language, Datastructure
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 2
Problem:
adding two reserved variables currentRow and recordCount to cfloop array
You can loop with array and you need to know the current row you have two options
1 use classic looping
...
<cfloop from="1" to="#ArrayLen(myArray)#" index=i>
...
<cfif BitAnd(i,1)> class="myDarkRow"<cfelse> class="myLightRow"</cfif>
...
#myArray[i]#
...
</cfloop>
...
2 Array parameter on cfloop introduced on cf8
...
<cfset row = 0 />
<cfloop array="#myArray#" index="myRow">
<cfset row=row+1>
...
<cfif BitAnd(i,1)> class="myDarkRow"<cfelse> class="myLightRow"</cfif>
...
#myRow#
...
</cfloop
It would be very efficient to have currentRow and recordCount on cfloop with array. So the code
can be used as
<cfloop array="#myArray#" index="myRow">
...
<cfif BitAnd(myRow.currentRow,1)> class="myDarkRow"<cfelse> class="myLightRow"</cfif>
...
#myRow#
...
</cfloop>
We do not have to add counter on the new method and will bring consistency with query looping
and will help developers to use interchangeable code.
Method:
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037367
External Customer Info:
External Company:
External Customer Name: Nuri Cevik
External Customer Email: 2DB6356443A04FCB99201549
External Test Config: 01/23/2009
Attachments:
Comments: