cfloop

Overview ColdFusion Open BlueDragon Lucee

Different items are required based on loop type. Items listed as required may not be depending on your loop type. Loop forms: [query] [condition] [index + from + to ] [index + list] [collection + item ]

Attributes

Name Required Type Default Description
8
3
array No AnyValue An array.
array from No The start index in the array to start the loop from
array index No The name of the variable that will contain the current position
array obj array No The array object to iterate over
array obj index No The element (or index) of the array (if INDEX and ITEM are specified then the INDEX is the number of the array, and the ITEM is the element in the array)
array obj item No The element of the array
array step No The number to step through
array to No The end index in the array to end the loop at
8
3
characters No Numeric The number of characters to read during each iteration of the loop from the file specified in the file attribute. If the value of the characters attribute is more than the number of characters in the file, ColdFusion uses the number of characters in the file.
charset No charset for read the file
collection No Object The collection attribute is used with the item attribute. often to loop over a structure
collection collection No The name of the collection/structure that will looped over
collection item No The name of the key of the collection on each iteration
condition No String Condition that controls the loop.
condition condition No The CONDITION that must be evaluated to TRUE to continue the loop
delimiters No String , Character(s) that separates items in list
endline No end line
endrow No Numeric Last row of query that is included in the loop.
8
file No String The absolute path and filename of the text file to read, one line at a time. This is helpful when reading large text files, because you can reuse the value of the index variable, which contains the current line of the file. When the loop completes, ColdFusion closes the file.
file characters No The number of characters that will be read for each iteration. The default is to read the file line-by-line
file charset No The character set to use for reading the file. Defaults to that of the system
file file No The path to the file that will iterated over
file index No The name of the variable that will contain the characters from the file
from No Numeric Ending value of index.
10
4
group No String Query column to use to group sets of records. Eliminates adjacent duplicate rows when data is sorted. Use if you retrieved a record set ordered on one or more a query columns. For example, if a record set is ordered on "Customer_ID" in the cfquery tag, you can group the output on "Customer_ID."
10
4
groupcasesensitive No Boolean Whether to consider the case in grouping rows.
index No String Index value. CFML sets it to from value and increments or decrements by step value, until it equals to value.
item No String The item attribute is used with the collection attribute. often to loop over a structure
4
label No used to a address this loop from a "break" or "continue" statement (instead of the nearest one).
list No String A list, variable, or filename; contains a list
list delimiters No The list of delimiters of this list
list index No The name of the variable that will contain the current element in the list
list list No Defined if wishing to loop over a list
4
maxrows No Specifies the maximum number of rows to display in the output section. You cannot use this attribute together with the attribute endrow.
query No Query Query that controls the loop.
query endrow No The end row of the query
query query No The name of the Query to loop over
query startrow No The starting row of the query
startline No start line
startrow No Numeric First row of query that is included in the loop.
step No Numeric Ending value of index.
4
struct No struct to loop over
to No Numeric Beginning value of index.