ColdFusion loop state attribute

I have a variable <cfset takeFour = 0 >. Then I have a loop that I want to run 4 times.

<cfloop query="getVids" condition="takeFour LTE 4">
                <cfset takeFour= takeFour + 1/>...

The CF debugger says there is an attribute validation error for this tag, however this syntax must be correct. Any ideas?

+3
source share
2 answers

When using cfloop to process a request, the acceptable attributes are: query, startRow, and endRow. The condition is not used when the request, so the compiler gives you an attribute validation error.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_j-l_10.html

+9
source

condition cfloop , , . :

<cfloop query="getVids">
    <cfset takeFour = takeFour + 1 />

    <cfif takeFour GT 4>
        <cfbreak />
    </cfif>
</cfloop>

, , :

<cfloop query="getVids" startrow="1" endrow="4">
</cfloop>
+7

Source: https://habr.com/ru/post/1788283/


All Articles