Skip to main content
Participant
April 18, 2014
Question

Problem running a Cfloop in a Cfoutput

  • April 18, 2014
  • 1 reply
  • 252 views

So I am trying to set up a table to have a set of rows repeated based on a variable set up in a separate location.  So I have table output being generated from a cfoutput of the query, then in the cfoutput tag, I have a cfloop statement with the <td>s for the columns that I need repeated based on my variable.  The problem I am experiencing is that the loop, instead of running from 1 to x (even when I hard coded the to = "2") is running per row the number of records in the cfoutput query in a decremental fashion, if my query has 11 rows, I get 11 loops the first run, then 10, then nine and so on. Has anyone experienced this before?  Here is the code, working with CF 9 on SQL Server 2012:

<cfoutput query="getNCDs">

     <tr>

          <td class="ins_grid_data">#getNCDs.ncdId#</td>

          <cfloop from="1" to="2" index="y" >

          <cfoutput>

......... and that is what is helpful about retyping things into a forum, sometimes you spot your own mistakes.  I don't need another <cfoutput> tag...I am IN a <cfoutput>. Took the extra tag out and the process worked the way I wanted it to.  Everybody have a good day.

Juss

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    April 19, 2014

    Good for you! Then mark your answer as 'correct'.