I have mentioned this workaround already in my original posting (see under "my workaround"). ;-)
This "error" (?) occurs every time I use this construction. Best regards, Peter ------------ Orginale Nachricht Von: "Kevin Langevin" <[EMAIL PROTECTED]> Betreff: RE: cfoutput + cfloop: bug or Datum/Zeit: Dienstag, 11. Februar 2003 18:22:36 > I usually set the outer query variable to a locally scoped variable inside > the outer loop, and that removes the problem. Weird thing is, CF only seems > to get confused sometimes, even if there are shared fieldnames...sometimes > it works just fine. I usually follow the set local variables practice as a > matter of course, and then I don't have to worry about it. > > -Kev > > -----Original Message----- > From: Ryan Emerle [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 11, 2003 11:55 AM > To: CF-Talk > Subject: RE: cfoutput + cfloop: bug or > > > Did you try this? > > <cfloop query="query1"> > <cfoutput>#query1.whatever#</cfoutput> > <cfloop query="query2"> > <cfoutput>#query2.whatever# #query1.whatever#</cfoutput> > </cfloop> > </cfloop> > > I have found when you try to mix queries like that, CF has a bit of a > problem, especially if query1 and query2 share fieldnames (even if you > 'scope' the queries). > > A work around would be something like this: > <cfloop query="query1"> > <!--- Query1 'scope' ---> > <cfoutput>#query1.whatever#</cfoutput> > > <!--- Save in Variable scope ---> > <cfset q1whatever=query1.whatever> > > <cfloop query="query2"> > <cfoutput>#query2.whatever# #q1whatever#</cfoutput> > </cfloop> > </cfloop> > > I've had to do perform similar workarounds in the past for these goofy > situations. I am also of the school that says output and loop iteration > should be separate, i rarely use cfouput to iterate through loops. > > HTH > -- > Ryan Emerle > -----Original Message----- > From: Peter Mayer [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 11, 2003 9:26 AM > To: CF-Talk > Subject: cfoutput + cfloop: bug or > > > Hello! > > I have two queries - the output of the first one is handled by a cfoutput > > tag, the second one is handled by a cfloop (nested construction): > > <cfoutput query="query1"> > bla bla #query1.name#: > <cfloop query="query2> > #query2.surname# (event: #query1.eventtitle#)<br> > </cfloop> > > </cfoutput> > > > Now I have the result that query1.eventtitle always returns the first row > > of query1, it's not looping as desired. > > my workaround: > > <cfoutput query="query1"> > bla bla #query1.name#: > <cfset a_str_title = query1.eventtitle> > > <cfloop query="query2> > #query2.surname# (event: #a_str_title#)<br> > </cfloop> > > </cfoutput> > > This works as expected. > > We are on CF 5 (MX in the future time) > > Best regards, > > Peter > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

