Skip to main content
Participant
January 19, 2009
Answered

dynamicly nestled cfloops

  • January 19, 2009
  • 3 replies
  • 612 views
Hello Every one,

I wondered if it is possible to dynamically nestle loops.

If i get a variable equal to 2 i would like to do something like this:

<cfloop query 1>
output 1
<cfloop query 2>
output 2
</cfloop>
</cfloop>

If i get a variable equal to3 i would like to do something like this:

<cfloop query 1>
output 1
<cfloop query 2>
output 2
<cfloop query 3>
output 3
</cfloop>
</cfloop>
</cfloop>

I have no idea how to go about to do this.
Thanks for any help!

Yann.
This topic has been closed for replies.
Correct answer Dan_Bracuk
I thought the triple post was some sort of dynamic nested loop.

Regarding your question, the only thing I can think of is to dynamically write the code as text, write the text to a file, then cfinclude the file. However, that depends on the complexity of what you want to output.

3 replies

Participant
January 19, 2009
Thank you Dan!

Indeed, that's how I finally built it. I just thought their might be a cleaner way to do it.
Dan_BracukCorrect answer
Inspiring
January 19, 2009
I thought the triple post was some sort of dynamic nested loop.

Regarding your question, the only thing I can think of is to dynamically write the code as text, write the text to a file, then cfinclude the file. However, that depends on the complexity of what you want to output.
Participant
January 19, 2009
Apology for triple upload, due to bad connection. Wanted to delete other 2 but couldn't find functionality to do so.