Coldfusion Nested Cfloop or Cfloop within a Cfloop

Posted by & filed under ColdFusion.

Coldfusion Cfloop within a cfloop or gives interesting results. I couldn’t believe it was a bug. But looks to be true once tested. Thanks to Blog of Jehiah Czebotar who bailed me out of this issue after looking at it for some time with eyes crossed and debugging.

Here is the summary from Jehiah blog post. Thanks Again Jehiah!

There is a bug in the processing of nested cfloop tags in Macromedia Cfloop ColdFusion MX, as the example below shows. I have developed a workaround for this which is also below.

Example of Problem



    
        #outerqueryset.column1# #innerqueryset.column1#

‘outerqueryset.column1‘ results in the first record’s data being displayed regardless of current iteration in the outer loop.

Workaround

The workaround is to force the display of the current row, by accessing it via array.


    
        #outerqueryset.column1[outerqueryset.currentrow]# #innerqueryset.column1#
    

							
					
						

Leave a Reply

  • (will not be published)