Re: odd.. cfoutput group and cfloop over query

2004-12-13 Thread Umer Farooq
Thanks for clarification...

Did not find any posts.. matching my request.. so posted..

just a FYI.. nested loops over queries worked fine for me.. in MX6.1.. 
infact I still have 2 systems without the 6.1 updater applied.. on which 
I tested the code.. however I think this point has been discussed 101X 
on this list.. so there goes 102 times.. :-)


--
Regards,

Pascal Peters wrote:
 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 - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187348
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=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: odd.. cfoutput group and cfloop over query

2004-12-10 Thread Pascal Peters
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