Title:
Bug 74802:Allow for (item in collection) syntax to work for *all* types of collection
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Sean Corfield / Sean Corfield (Sean Corfield)
Created: 01/06/2009
Components: Language, CFSCRIPT
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 11
Problem:
Allow for (item in collection) syntax to work for *all* types of collection.
Currently you can use for (key in someStruct) to loop over a structure but you cannot loop over an array or query using a similar syntax.
For an array, you must do for (i = 1; i <= arrayLen(someArray); ++i) - but <cfloop> allows the simpler <cfloop index="element" array="#someArray#"> to iterate over elements. It would be great to say for (element in someArray) and have element take on each array element's value just like the <cfloop array=> syntax.
For a query, you must do for (i = 1; i <= someQry.recordCount; ++) and then someQry['col'][i] to access the elements. With <cfloop> you can simply iterate over the rows. It would be great to say for (row in someQry) and then row.col directly inside the loop.
Method:
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037178
External Customer Info:
External Company:
External Customer Name: Sean Corfield
External Customer Email: 479B4EDC43F3A88B992016B6
External Test Config: 01/06/2009
Attachments:
Comments: