I'm working with quite a large array of items in a cfloop. I would like to pare this down and add pagination. Is there anyway in my cfloop to limit the array to the first 10?
I have
<cfloop array="#qryItems#" index="index">
I have tried turning it into a condition loop with no luck and a few other things. I haven't touched coldfusion in a while and am a little rusty. Google is not helping haha
I have tried
<cfloop from="1" to="10" array="#qryItems#" index="index">
and have also tried max_rows
<cfloop maxrows="10" array="#qryItems#" index="index">
each time I get the error message
"Attribute validation error for tag CFLOOP."
There is no combination of attributes for
cfloopto accomplish what your expecting. As BKBK suggested, you'll need to use afrom/toloop to output a select group of records. If I understand your requirements correctly, I would update yourcfloopwith a new index variable as well, and then set the old variable by referencing the array element.The two
cfloopsbelow output the same data, with the second displaying only the records in the pagination range.