Smith, Daron [PA] wrote: > Is it possible to loop over a query until a condition is met? Specifically, > I am returning search results, if a certain category exists i want to > display a title, if no records for that category exist I do not want to > display the title. However I only want to display the title one time if the > records exist. Looping over the query will display the title the number of > times that the condition exists in the recordset, but a conditional query > doesn't appear to allow a query to loop over.
Use strucure-of-arrays style notation to do this: <cfoutput> <cfloop from="1" to="#queryname.recordcount#" index="i"> if ..... #queryname.columnname[i]# elseif <cfset i = i - 1> else <cfset i = i + 1> </cfloop> </cfoutput> Jochem ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists