Getting Record Number within a Looping Query
If I am looping over a query, how do I get the current record number for the loop? e.g. If I am looping for a fixed number of iterations, I can use an index=loopcount and get the current loop number. How do I do this for a query? TNX. rick. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338734 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Getting Record Number within a Looping Query
queryName.currentRow On Mon, Nov 1, 2010 at 3:53 PM, Rick Colman rcol...@cox.net wrote: If I am looping over a query, how do I get the current record number for the loop? e.g. If I am looping for a fixed number of iterations, I can use an index=loopcount and get the current loop number. How do I do this for a query? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338735 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Getting Record Number within a Looping Query
It depends on whether you mean a literal loop (ie cfloop) or a cfoutput loop. Both populate a special variable called #currentRow# when iterating through a query. Limiting the number of iterations works different for each tag: http://livedocs.adobe.com/coldfusion/8/Tags_m-o_16.html http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_j-l_14.html ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338737 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm