Could this be the old nested loop issue?  You have to set a local var to be 
equal to the current row of the outer loop.  Then you use the local var in 
the inner loop.

<cfloop query="outer">
<cfset whatever = outer.whatever>
    <cfloop query="inner">
    #whatever#
    </cfloop>
</cfloop>

Ben Nadel has a blog entry about this.

-- Josh


----- Original Message ----- 
From: "Christopher Chin" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Tuesday, May 22, 2007 2:01 PM
Subject: CFLOOP help


>I have this cfloop issue that is driving me bananas...I'm trying to create 
>a tree menu for one of my apps.
>
> Supposed to look like this:
>
> Building: XXXXX
> (list of employees seated in this building)
>
> Not seated:
> (employees not seated anywhere)
>
> Since there's going to be a varying amount of buildings I select all the 
> employees from a search criteria, and then do a query of a query to get 
> the distince buildings within this search result.  MY ISSUE: I'm missing 
> data for building 1500.  Seems as if the 2nd iteration through the outer 
> loop isn't advancing the currentRow.  Hopefully someone can see where I'm 
> going wrong here.
>
> See CFDUMP of my queries here:
> http://www.christopherchin.com/empresult.jpg
> First dump is the actual query results.  Second dump is a query of a query 
> to get the distinct building numbers.
>
> This is my output:
> =================
> Building: 160
> Brian Malone
>
> Building: 1500
> Brian Malone
>
> Not Mapped:
> Alison Greenberg
> Amrita Sohal
> Ashley Brochstein
> Chris McBain
> David Djanikian
> Eric Toner
> John Quevedo
> Katie Tarulli
> Martha Ohara
> Matthew Elkins
> Maureen Haskell
>
> Here's my code:
> <cfloop query="distinctBuilding" startrow="1" 
> endrow="#distinctBuilding.recordCount#">
> <cfif #distinctBuilding.building# NEQ "">
> Building: #distinctBuilding.building#<br />
> <cfloop query="empResult">
> <cfif #trim(empResult.building)# EQ #trim(distinctBuilding.building)#>
> #empResult.fname# #empResult.lname#<br />
> </cfif>
> </cfloop>
> <cfelse>
> Not Mapped:<br />
> <cfloop query="empResult">
> <cfif #empResult.building# EQ "">
> #empResult.fname# #empResult.lname#<br />
> </cfif>
> </cfloop>
> </cfif>
> <br />
> </cfloop>
>
> Thanx!
> Chris
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278923
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to