Interesting, now wouldn't a simple enough fix be to just add entityID to the
output of volunteers since that query is built off the id anyway?

On 2/22/06, Rick Root <[EMAIL PROTECTED]> wrote:
>
> Aaron Rouse wrote:
> > Strange, I code like that quite often and never have it return just the
> > first instance.  It would return a repeat though since it would be
> inside an
> > inner loop.  So if getRosters has a record count of 5 and then each
> > volunteers query has a record count of 4 you get displayed the same
> entity
> > ID 20 times?
>
> Yes.
>
> It's like if you did this:
>
> <cfquery name="getRoster" ...>
>   select entityid, prmlname from entities
> </cfquery>
> <cfoutput>#getRoster.entityid#</cfoutput>
>
> Since you'rre not inside a query-based cfoutput, it outputs the value
> from the first row.
>
> I think that's what's happening when it doesn't find entityid in the
> innermost query..  it doesn't seem to realize that it's nested inside
> another query..
>
> Here's some example code that shows this:
>
> <cfscript>
>        qry1 = queryNew("ENTITYID,FULLNAME,ZIP,DEGREE");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123450");
>        querySetCell(qry1,"FULLNAME","John A. Doe");
>        querySetCell(qry1,"ZIP","48169");
>        querySetCell(qry1,"DEGREE","BS");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123451");
>        querySetCell(qry1,"FULLNAME","John B. Doe");
>        querySetCell(qry1,"ZIP","27502");
>        querySetCell(qry1,"DEGREE","BA");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123452");
>        querySetCell(qry1,"FULLNAME","John B. Doe");
>        querySetCell(qry1,"ZIP","27502");
>        querySetCell(qry1,"DEGREE","PhD.");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123453");
>        querySetCell(qry1,"FULLNAME","John C. Doe");
>        querySetCell(qry1,"ZIP","90210");
>        querySetCell(qry1,"DEGREE","BS");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123454");
>        querySetCell(qry1,"FULLNAME","John D. Doe");
>        querySetCell(qry1,"ZIP","10101");
>        querySetCell(qry1,"DEGREE","MS");
>        queryAddRow(qry1,1);
>        querySetCell(qry1,"ENTITYID","0000123455");
>        querySetCell(qry1,"FULLNAME","John E. Doe");
>        querySetCell(qry1,"ZIP","48103");
>        querySetCell(qry1,"DEGREE","JD");
>
>        qry2 = queryNew("VOLUNTID,VOLUNTNAME");
>        queryAddRow(qry2,1);
>        querySetCell(qry2,"VOLUNTID","janedoe1");
>        querySetCell(qry2,"VOLUNTNAME","Jane A. Doe");
>        queryAddRow(qry2,1);
>        querySetCell(qry2,"VOLUNTID","janedoe2");
>        querySetCell(qry2,"VOLUNTNAME","Jane B. Doe");
>        queryAddRow(qry2,1);
>        querySetCell(qry2,"VOLUNTID","janedoe3");
>        querySetCell(qry2,"VOLUNTNAME","Jane C. Doe");
>        queryAddRow(qry2,1);
>        querySetCell(qry2,"VOLUNTID","janedoe4");
>        querySetCell(qry2,"VOLUNTNAME","Jane D. Doe");
>        queryAddRow(qry2,1);
>        querySetCell(qry2,"VOLUNTID","janedoe5");
>        querySetCell(qry2,"VOLUNTNAME","Jane E. Doe");
> </cfscript>
>
> <cfoutput query="qry1" GROUP="ENTITYID">
> #ENTITYID# #FULLNAME# #ZIP# <br>
> Degrees: <cfoutput>#DEGREE# </cfoutput><br>
> <cfloop query="qry2">
>        <!--- qry1.entityid should output the CURRENT entity,
>                but it does not --->
>        Volunteer: #qry1.ENTITYID# #VOLUNTID# #VOLUNTNAME#<br>
> </cfloop>
> <br>
> </cfoutput>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233133
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to