Skip to main content
Participant
September 2, 2008
Answered

Writing CFIF within a loop

  • September 2, 2008
  • 1 reply
  • 614 views
Hi -

I've googled all over for this simple chunk of code to no avail. I have a CFQUERY grouped by date, which is returning about 10 records right now. I want to sneak in an icon to accompany the first record returned, leaving the remain 9 records to loop with no icon. I'm assuming it's a simple CFIF checking to see if it's the first row or the query result, but I can't find the syntax.

Any help?

Thanks!
This topic has been closed for replies.
Correct answer -__cfSearching__-
Bill c1natra wrote:
> want to sneak in an icon to accompany the first record returned

You can use the #currentRow# variable. It is populated inside cfloop and cfoutput when you use a query. Its value is the current record number within the query loop, starting from 1.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.html

1 reply

-__cfSearching__-Correct answer
Inspiring
September 3, 2008
Bill c1natra wrote:
> want to sneak in an icon to accompany the first record returned

You can use the #currentRow# variable. It is populated inside cfloop and cfoutput when you use a query. Its value is the current record number within the query loop, starting from 1.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.html

c1natra33Author
Participant
September 3, 2008
Thank you! Big help.