Skip to main content
Known Participant
March 8, 2011
Question

Counting with CF

  • March 8, 2011
  • 1 reply
  • 332 views

Hi all,

Is there anyway to use CF to count?  Sounds simple, but I'm querying a table with x amount of records and I need the output to be numbered 0-recordcount consecutively (first returned record would be 0, second returned record would be 1, etc.).  I thought about making a field in the table to input the numbers manually, or using an autonumber, but as records are added and deleted, these numbers will become inaccurate.  The output numbes really don't need to be related to the data in the table, I just need consecutive numbers starting with 0.

Thanks!

    This topic has been closed for replies.

    1 reply

    Inspiring
    March 8, 2011

    can I recommend you start with the docs for CFQUERY - http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fae.html - and CFLOOP - http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-71a8.html - paying specific attention to RECORDCOUNT and CURRENTROW.

    --

    Adam