Sure, I was overly simplistic.

But I didn't want to try to explain nested loops and the group attribute.

I was really trying to show the mechanism for accessing the query rows and columns 
directly, without needing to rely on the query attribute of CFOUTPUT and CFLOOP.

But if you are going to suggest how to handle this guy's query needs using two nested 
query loops, you should give him an example of how it would work.

Jerry Johnson


>>> [EMAIL PROTECTED] 04/16/02 02:54PM >>>
That's not true.  I have MANY apps that have nested queries.

Brian Yager
President - North AL Cold Fusion Users Group
Sr. Systems Analyst
NCCIM/CIC
[EMAIL PROTECTED] 
(256) 842-8342


-----Original Message-----
From: Jerry Johnson [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 16, 2002 1:41 PM
To: CF-Talk
Subject: Re: Query Trouble


This has got to be in the FAQ.  By the way, where's the FAQ?

To cut from a similar answer a few days ago:

   My understanding is that you can only run through one query at a time (with
CF handling the currentRow your on.)

   So you are going to want to only rely on the query= for one of your two
loops. Or maybe none.

   This is not the only way, but it should work.

   Other people will chime in with the correct (and faster) ways, but this
should get you going.

   <cfoutput>
       <cfloop index="cRow" from="1" to="#SecondQuery.recordCount#" step="1">
       #SecondQuery['RowName'][cRow]#
       <cfloop index="cRow2" from="1" to="#first.recordCount#" step="1">
           #SecondQuery['RowName'][cRow]#
           #first['RowName'][cRow2]#
       </cfloop>
   </cfoutput>


If this doesn't help, shout out and I'll try a more specific answer.
Jerry Johnson



>>> [EMAIL PROTECTED] 04/16/02 02:29PM >>>
Can someone point out why this query is only getting the last group of
records?
A second set of eyes would really help!
 
If the query qGroups returns the following eventtypes: ItemA, ItemB, ItemC
Only group ItemC and records that are in ItemC will print out.
 
------------------------------
<CFQUERY NAME="qGroups" DATASOURCE="Events">
SELECT DISTINCT EventType
FROM Events
</CFQUERY>
 
<CFOUTPUT QUERY="qGroups">
            <CFQUERY NAME="qSpecificLocations" DATASOURCE="Events">
                        SELECT EventID,EventType,X,Y,EventText
                        FROM Events
                        WHERE EventType = '#qGroups.EventType#'
            </CFQUERY>
 
<CFIF IsDefined("qSpecificLocations.RecordCount") AND
qSpecificLocations.RecordCount GTE 1>
<CFLOOP QUERY="qSpecificLocations">                
 
#qGroups.CurrentRow#,#qSpecificLocations.CurrentRow#,#qSpecificLocations.X#,
#qSpecificLocations.Y#);
</CFLOOP>
</CFIF>
 
</CFOUTPUT>
------------------------------
Thanks,
Dave
 
 
 




______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to