Chad, Since Query object are passed by reference, I think it has trouble maintaining nested indexes (this is my theory). Remember, in a loop, the "current row" of a query is getting updated. It is doing some sort of internal iterator I think. Now, for most cases it should matter, but think about what would happen if you had two nested loops that were looping over the same query. As I have demonstrated (http://www.bennadel.com/index.cfm?dax=blog:322.view) this performs in the same way. I can't see a good way for an iterator to maintain two different states.
As a result, the outer loop is always at the "first" record while the inner loop is executing. I think your solution (of creating an interim variable) is the best solution. And this is all theory, someone please correct me if I am way off. ...................... Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -----Original Message----- From: Chad Gray [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 07, 2006 5:00 PM To: CF-Talk Subject: cfloop in a cfoutput I have run into this in the past, but never asked anyone why it occurred or if there is a better way of doing this. If I have a CFLoop inside of a CFoutput and inside the CFLoop I call a variable from the surrounding CFoutput query I get a blank. I have to set the variable as a local variable in order to use it in the CFLoop. Below does not work: <cfoutput query="getPages"> <form action=""> <select name="Status"> <cfloop query="getPageStatusTypes"> <option <cfif getPageStatusTypes.PageStatus EQ getPages.status>SELECTED</cfif>></option> </cfloop> </select> </form> </cfoutput> Below DOES work: <cfoutput query="getPages"> <cfset localstatus = getPages.status> <form action=""> <select name="Status"> <cfloop query="getPageStatusTypes"> <option <cfif getPageStatusTypes.PageStatus EQ variables.localstatus>SELECTED</cfif>></option> </cfloop> </select> </form> </cfoutput> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259539 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

