A better way to handle variables when nesting CFLOOP

A better way to handle variables when nesting CFLOOP

Kyle Godard
//

If you try to reference a value from the outer query within a nested CFLOOP you normally get only the first value from the outer query rather than the value of the current row. In the past a common solution has been to store a temporary value before the nested loop.

 

     
     
          #qCities.City#, #tempState#

    

 

But this can become cumbersome when dealing with several values and a layer of complexity when reading through the code. A better way to do this is to access the outer query directly using the current row.

 

     
          #qCities.City#, #qStates["State"][qStates.CurrentRow]#
     

 

SIGMA RAPID START

Switching your analytics to Sigma?
Speed up success with a Rapid Start!

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!