How can I loop over a query for a specific number of times that may be greater than the result?

Posted by JS on Stack Overflow See other posts from Stack Overflow or by JS
Published on 2010-03-20T21:30:52Z Indexed on 2010/03/20 22:11 UTC
Read the original article Hit count: 245

Filed under:

I need to loop over a query exactly 12 times to complete rows in a form but rarely will the query return 12 rows. The cfquery endRow attribute doesn't force the loop to keep going if the result is < 12. If it did that would be ideal to use something like cfloop query="myQuery" endRow="12"... The 2 options that I have now are to skip the loop and write out all 12 rows but that results in a lot of duplicate code (there are 20 columns), or do a query of queries for each row which seems like a lot of wasted processing. Thanks for any ideas.

© Stack Overflow or respective owner

Related posts about coldfusion