Subscribe: Comments on: ColdFusion bug or feature?
http://awads.net/wp/2006/04/05/coldfusion-bug-or-feature/feed/
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
cfloop query  cfloop  cfoutput cfloop  cfoutput  code  inside loop  inside  loop cfoutput  loop  pre  query  recnum currentrow  recnum  row 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Comments on: ColdFusion bug or feature?

Comments on: ★ ColdFusion bug or feature?



News, views, tips and tricks on Oracle and other fun stuff



Last Build Date: Tue, 19 Aug 2014 05:55:04 +0000

 



By: Eddie Awad

Wed, 05 Apr 2006 19:35:07 +0000

Thanks guys for the clarification. By looking at the code alone, you would not think that q1.recnum in the q2 loop is in fact implicitly treated as q1.recnum[1]. Testing is important.

To solve this issue, I copied q1.recnum to the variables scope and used the variable inside the q2 loop:



    Inside q2 loop: #variables.recnum#
    

But now I know that there is another way: q1.recnum[q1.currentRow]

Thanks again.




By: Ryan Guill

Wed, 05 Apr 2006 16:52:43 +0000

I had this same problem not long ago. I posted it to cf-talk if you want to see the discussion on it. If you cant find it let me know.

But what you need to make it work is instead of Inside q2 loop: #q1.recnum#

use


    Inside q2 loop: #q1.recnum[q1.currentRow]#
    

The current row is always correct where the loop gets messed up. This will force it to be correct.




By: Barney

Wed, 05 Apr 2006 16:23:01 +0000

To put Ray's comment another way: only the innermost query is ever implicitly referenced, all other queries must be referenced with full name.column[row] notation, and as you know, leaving off the row uses an implicit 1.




By: Raymond Camden

Wed, 05 Apr 2006 15:55:44 +0000

Inside q2, when CF "talks" to the q1 query,it is NOT in the contest of cfoutput query=q1 anymore. Therefore it acts the same as

q1.columnname[1]