This has always been like this (and must have been discussed a 100x on
this list). When you have nested loops over queries (it doesn't matter
if you are using cfoutput or cfloop), coldfusion looses the reference to
the first query when looping the second. This means that you can't drop
the prefix (which you shouldn't in the first place) and that
q1.currentRow will always return 1 (and q1.column will always return the
value from the first record. You have already found the solution for
that problem: set the value to a variable before the second loop.

If you have a lot of fields from the first query to access in the second
loop, just save the currentRow in a variable and use array notation for
the first query.

<cfloop query="q1">
  <cfset i = q1.currentRow>
  <cfloop query="q2">
    <cfif q2.c1 IS q1.c1[i]>
          do something
        </cfif>
  </cfloop>
</cfloop>

Pascal

> -----Original Message-----
> From: Umer Farooq [mailto:[EMAIL PROTECTED]
> Sent: 10 December 2004 02:54
> To: CF-Talk
> Subject: odd.. cfoutput group and cfloop over query
> 
> Hi,
> 
>     I'm getting this odd.. problem.. when doing..
> 
>     <cfouput query="QUERYONE" group="SOMECOLUMN">
>        <cfloop query="QUERYTWO">
>          <cfif QUERYONE.XID eq QUERYTWO.YID>
>           SOMETHING
>          </cfif>
>        </cfloop>
>     </cfoutput>
> 
>     in the loop QUERYONE.XID will keep the first row value.
> 
>     if I remove the prefix from XID.. it gives me an error saying its
> not defined. Which is odd by itself.
> 
>     I can get away from the error by setting a variable.. before the
> loop and then compare on it..
> 
>     Any thoughts on this..

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186952
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