Okay, what do you mean by properly referencing the
queries?

I always use the queryname.columnname inside of a loop,
even a single loop.  In this case, I added the
variables scope to it as well.  The issue is not a
duplication of variable names.  The issue is that the
second query does not exist at all inside of the outer
loop.  If I do a <cfdump on the second query before the
outer loop, I get the full recordset.  If I do a
<cfdump on the second query inside the outer loop, I
get null - the second query has been wiped out.

If it matters, I am running this on CF5 Standard.

-- Jeff


-----Original Message-----
From: Bryan Stevenson
[mailto:[EMAIL PROTECTED]]
Sent: Monday, December 02, 2002 4:45 PM
To: CF-Talk
Subject: Re: Nested Query Loops


I beleive this is the case ALWAYS even if the 2 queries
have seperate names
and fields.  This "feature" is there to prevent the
issue I mentioned.  It
forces you to properly reference your variables ;-)

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

-------------------------------------------------------
--
Macromedia Associate Partner
www.macromedia.com
-------------------------------------------------------
--
Vancouver Island ColdFusion Users Group
Founder & Director
www.cfug-vancouverisland.com
----- Original Message -----
From: "Jeff D. Chastain" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 2:39 PM
Subject: RE: Nested Query Loops


> I can see that ... The issue is that I have two
differently named
> queries with differently named columns.  The CF error
is that the inner
> query does not even exist, which is verified with a
<cfdump prior to the
> inner loop.   For some reason, that query variable
goes to null within
> the outside loop.
>
> -- Jeff
>
>
> -----Original Message-----
> From: Bryan Stevenson
[mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 02, 2002 4:34 PM
> To: CF-Talk
> Subject: Re: Nested Query Loops
>
>
> Well...think about your nested loop having fieldnames
that same as the
> outer loop....
>
> CF has to know which field you are referencing ;-)
>
> Bryan Stevenson B.Comm.
> VP & Director of E-Commerce Development
> Electric Edge Systems Group Inc.
> t. 250.920.8830
> e. [EMAIL PROTECTED]
>
> -----------------------------------------------------
----
> Macromedia Associate Partner
> www.macromedia.com
> -----------------------------------------------------
----
> Vancouver Island ColdFusion Users Group
> Founder & Director
> www.cfug-vancouverisland.com
> ----- Original Message -----
> From: "Jeff D. Chastain" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, December 02, 2002 2:30 PM
> Subject: RE: Nested Query Loops
>
>
> > I was referring to the inner query using the full
scoped name -
> > variables.queryName.
> >
> > So, why does setting newQueryName =
variables.queryName PRIOR to
> > looping the first query change anything?  Both
variables are in the
> > variable scope and are created prior to the first
loop - they should
> > be the same right?
> >
> > BTW - copying the query over to a new name worked.
Now the question
> > is why?
> >
> > Thanks
> >
> >
> > -----Original Message-----
> > From: Keith Dodd [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, December 02, 2002 3:17 PM
> > To: CF-Talk
> > Subject: Nested Query Loops
> >
> >
> > Not sure this is the problem, but I've had problems
with nesting
> > loops, forgetting that you need to set a variable
from the outer loop
> > (with a new name) before using that variable in the
inner loop. I
> > don't understand why, but variables get confused in
nested loops. This
>
> > *might* have something to do with it.
> >
> > Keith Dodd
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~|
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
Get the mailserver that powers this list at
http://www.coolfusion.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to