I have a simple list: 1, 3, 6, 7, 11, 13, 16, 21
I want to count the list where the numbers are greater than 8. So my end result for this list should be "4" (11, 13, 16, 21).
I've read through all the list functions and nothing seems to fit. How do I evaluate the items in a list to see fi they greater than 8 then count only those items?
Thanks
Initialise a new list as an empty string.
Loop over the first list with CFLOOP:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461 172e0811cbec22c24-71a7.html
Check each element for your condition.
If it meets the condition, append it to the new list.
After the loop, the new list will have the values you want.
There is no more expedient way of doing it than that, really.
--
Adam
Well: if yer on CF10, there's listFilter() which might work for you:
http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSf23b27ebc7b554b6 1273c87513585aed2a9-8000.html
It's probably not as expedient as just looping over the list though.
--
Adam
North America
Europe, Middle East and Africa
Asia Pacific