On each loop, whatever values you want to use in your inner loops need
to be set to a local variable in the loop.
In fact, been burned so many times now I just dont bother using the loop
count and alwasy set the variables I need straight after my cfloop

ie

<cfloop query="qSomething">
        <cfset loop1Col1 = qSomething.MultiplyBy20 >
        <cfset loop1Col2 = qSomething.MultiplyBy30 >
        
        <cfloop from="1" to="100" index="tIndex">
                <cfset output1 = loop1Col1 * tIndex>
                <cfset output2 = loop1Col2 * tIndex>
                <cfoutput>#tIndex# - #output1#  - #output2#</cfoutput>
        </cfloop>
</cfloop>

Trying to access it as...
<cfset output1 = qSomething.MultiplyBy20 * tIndex>

Doesn't work (well, i didn't test the code but I hope you get my drift)

There is a tech support somewhere about this on the MM site but I can't
find much (no patience with it) any more and prefer looking elsewhere


This could be described as a FEATURE of cold fusion....hehehehe



-----Original Message-----
From: Tony Schreiber [mailto:[EMAIL PROTECTED] 
Sent: 27 March 2003 17:04
To: CF-Talk
Subject: Nested Query Loop Bug/Issue


I don't know if any of you have run into this before or if it's even
been mentioned (couldn't find it at mm technotes either), but I've run
into a situation where the values of an outer loop referred to in an
inner loop are not what you expect. I was burned on this recently and
remember vaguely it happening to me before. I've written some
demonstration code to
illustrate:

http://www.simplemessageboard.com/loopbug.cfm

The solution as shown in the code is to set a local variable BEFORE you
begin the inner loop to hold the value of the outer loop you want to
refer to within the inner loop.

Anyone had this happen? Or is this expected behavior that I can't see?

BTW, this is CF5, I don't know about MX.


Tony Schreiber, Senior Partner                  Man and Machine, Limited
mailto:[EMAIL PROTECTED]                   http://www.technocraft.com

http://www.is300.net The Enthusiast's Home of the Lexus IS300 since 1999
http://www.simplemessageboard.com    Free Forum Software for Cold Fusion


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to