Re: odd.. cfoutput group and cfloop over query
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
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
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.. Regards, -- Umer Farooq Octadyne Systems [EMAIL PROTECTED] +1 (519) 772-5424 voice +1 (519) 635-2795 mobile +1 (208) 275-3824 fax LOOKING FOR A USED CAR IN IOWA VISIT: http://www.IowaMotors.com WARNING: --- The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind. ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186934 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