<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p79.htm</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-25T01:32:16</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#46500" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#29236" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#27603" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#25195" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#22158" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18270" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18269" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#17446" />
				<rdf:li rdf:resource="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#11820" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#46500">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#46500</link>
		<description>I think to be a little more clear, yes there is a problem when nesting loops w/ queries. It seems that the inner loop takes over the scope therefore preventing your outer loop from iterating. A simple fix though would be this:&lt;br /&gt;&lt;br /&gt;&lt;cfloop query=&quot;outerloop&quot;&gt;&lt;br /&gt;     &lt;cfset nestedVar = outerloop.value&gt;&lt;br /&gt;     &lt;!-- any other values you may need in the loop --&gt;&lt;br /&gt;          &lt;cfloop query=&quot;innerloop&quot;&gt;&lt;br /&gt;               #nestedVar#&lt;br /&gt;          &lt;/cfloop&gt;&lt;br /&gt;               &lt;cfset nestedVar = 0&gt;&lt;br /&gt;&lt;/cfloop&gt;</description>
		<dc:creator>GameDev</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2006-03-27T13:17:00</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#29236">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#29236</link>
		<description>Nested &lt;cfloop query=&quot;&quot;&gt; statements are indeed buggy. The workaround is to use an additional variable in the outer loop:&lt;br /&gt;&lt;br /&gt;&lt;cfquery name=&quot;q1&quot; ...&gt;&lt;br /&gt;&lt;cfloop query=&quot;q1&quot;&gt;&lt;br /&gt;inner: #q1.x#&lt;br /&gt;&lt;cfset temp = #q1.x#&gt;&lt;br /&gt;&lt;cfquery name=&quot;q2&quot; ...&gt;&lt;br /&gt;&lt;cfloop query=&quot;q2&quot;&gt;&lt;br /&gt;outter: #temp#&lt;br /&gt;&lt;/cfloop&gt;&lt;br /&gt;&lt;/cfloop&gt;</description>
		<dc:creator>kuMX</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-03-08T07:43:16</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#27603">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#27603</link>
		<description>When I nest multiple &lt;cfloop query=&quot;&quot;&gt; statements I have a problem of the 2nd loop &quot;remembering&quot; what happened in the first itterations, &lt;br /&gt;eg, say q1 returns a list of numbers from 1 through 10 and q2 returns 1 row&lt;br /&gt;&lt;cfquery name=&quot;q1&quot; ...&gt;&lt;br /&gt;&lt;cfloop query=&quot;q1&quot;&gt;&lt;br /&gt;  inner: #q1.x#&lt;br /&gt;  &lt;cfquery name=&quot;q2&quot; ...&gt;&lt;br /&gt;  &lt;cfloop query=&quot;q2&quot;&gt;&lt;br /&gt;    outter: #q1.x#&lt;br /&gt;  &lt;/cfloop&gt;&lt;br /&gt;&lt;/cfloop&gt;&lt;br /&gt;&lt;br /&gt;I will get:&lt;br /&gt;inner: 1&lt;br /&gt;outter: 1&lt;br /&gt;..&lt;br /&gt;inner: 2&lt;br /&gt;outter: 1&lt;br /&gt;..&lt;br /&gt;inner: 3&lt;br /&gt;outer: 1&lt;br /&gt;&lt;br /&gt;why?</description>
		<dc:creator></dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2005-02-09T00:27:50</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#25195">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#25195</link>
		<description>It is possible to put into a cfloop with query a nested cfloop using any value of the external loop?&lt;br /&gt;&lt;br /&gt;&lt;cfquery name=&quot;names&quot;&gt;&lt;br /&gt;   Select name, ID_Name, area, areabelong&lt;br /&gt;   from tnames&lt;br /&gt;   order by ID_name&lt;br /&gt;&lt;/cfquery&gt;&lt;br /&gt;&lt;br /&gt;&lt;cfquery name=&quot;myarea&quot;&gt;&lt;br /&gt;   Select name, ID_Name, area, areabelong&lt;br /&gt;   from tnames&lt;br /&gt;   where area = #area#&lt;br /&gt;&lt;/cfquery&gt;&lt;br /&gt;&lt;br /&gt;what i need is:&lt;br /&gt;&lt;br /&gt;&lt;cfloop query=&quot;names&quot;&gt;&lt;br /&gt; &lt;cfoutput&gt;&lt;br /&gt;   &lt;cfset myarea = #myarea.area#&gt;&lt;br /&gt;   &lt;cfset belong = #areabelong#&gt;&lt;br /&gt; &lt;/cfoutput&gt;&lt;br /&gt;  &lt;cfloop condition = &quot;myarea is not belong &quot;&gt;&lt;br /&gt;   &lt;cfquery name = &quot;notmine&quot;&gt;&lt;br /&gt;      Select area&lt;br /&gt;      from tnames&lt;br /&gt;      where area = #belong#&lt;br /&gt;  &lt;/cfquery&gt;&lt;br /&gt;  &lt;cfoutput&gt;&lt;cfset belong = #notmine.area#&gt;&lt;/cfoutput&gt;&lt;br /&gt;  &lt;cfif #notmine.area# is 0&gt;&lt;br /&gt;    &lt;cfbreak&gt;&lt;br /&gt;  &lt;/cfif&gt;&lt;br /&gt;  &lt;/cfloop&gt;&lt;br /&gt;  &lt;cfif #notmine.area# is not 0&gt;&lt;br /&gt;      &lt;cfoutput&gt; #name#, #area#&gt;br&gt;&lt;br /&gt; &lt;/cfif&gt;&lt;br /&gt;&lt;/cfloop&gt;&lt;br /&gt;&lt;br /&gt;I just want a list from all those are in my area beyond areabelong  is not like myarea</description>
		<dc:creator>ultrarodMX</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-12-08T16:46:37</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#22158">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#22158</link>
		<description>Nice.. wonder if the seemingly dodgy ripoff named &quot;BlueDragon&quot; can muster that...&lt;br /&gt;&lt;br /&gt;Another advantage of course is removing the need to treat queries as arrays when done inside outer queries with overkill such as...&lt;br /&gt;&lt;CFLOOP from=&quot;1&quot; to=&quot;#myQuery.recordCount#&quot; index=&quot;x&quot;&gt;&lt;br /&gt;  item number #x# in this subqueries name is: #item[x]#&lt;br /&gt;&lt;/CFLOOP&gt;&lt;br /&gt;&lt;br /&gt;But really, I guess I'm just expanding on the previous point, so probably shouldn't post this, ahh well, guess for yourself whether I clicked &quot;Submit&quot; or &quot;Cancel&quot;</description>
		<dc:creator>herakles_uk1</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-10-10T16:34:36</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18270">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18270</link>
		<description>However, that in itself is one of the advantages of looping over a query. Should there be for some reason a need to nest a query output loop, you can write something like this:&lt;br /&gt;&lt;br /&gt;&lt;cfoutput query=&quot;outerQuery&quot;&gt;&lt;br /&gt;  &lt;cfloop query=&quot;innerQuery&quot;&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Of course, that's not best practice, but then this book isn't about best practices. &lt;br /&gt;&lt;br /&gt;Another (probably more important) advantage of cfloopping over a query is whitespace control. Even if this command is issued:&lt;br /&gt;&lt;cfsetting enableoutputonly=&quot;true&quot;&gt;&lt;br /&gt;one can still control whitespace inside a &lt;,cfloop&gt; unlike in a &lt;cfoutput query=&quot;&quot;&gt;</description>
		<dc:creator>ECDatDOT</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-07-09T12:28:55</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18269">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#18269</link>
		<description>There is no specific reason not to use a cfinclude inside a cfoutput tag.&lt;br&gt;We should remove the statement:&lt;br&gt;&quot;The advantage of looping over a query is that you can use CFML tags that are not allowed in a cfoutput tag.&quot;</description>
		<dc:creator>halL</dc:creator>
		<dc:type>1 1</dc:type>
		<dc:date>2004-07-09T12:13:53</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#17446">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#17446</link>
		<description>The last of the new examples has a typo:&lt;br /&gt;&lt;cfquery name=&quot;GetTemplate&quot;&gt;&lt;br /&gt;...&lt;br /&gt;&lt;cfloop query=&quot;TemplateName&quot;&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;And I've never heard of &lt;cfinclude&gt; not being allowed inside a &lt;cfoutput&gt; before.</description>
		<dc:creator>ECDatDOT</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-06-22T08:38:00</dc:date>
	</item>
	<item rdf:about="http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#11820">
		<title>coldfusion/6.1/htmldocs/tags-p79.htm</title>
		<link>http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p79.htm#11820</link>
		<description>We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page.&lt;br /&gt;&lt;br /&gt;&lt;cfquery name = &quot;MessageRecords&quot; &lt;br /&gt;   dataSource = &quot;cfsnippets&quot;&gt; &lt;br /&gt;      SELECT * FROM Messages &lt;br /&gt;&lt;/cfquery&gt;&lt;br /&gt;&lt;cfloop query = &quot;MessageRecords&quot;&gt; &lt;br /&gt;   &lt;cfoutput&gt;#Message_ID#&lt;/cfoutput&gt;&lt;br&gt;&lt;br /&gt;&lt;/cfloop&gt;&lt;br /&gt;&lt;br /&gt;The cfloop tag also iterates over a record set with dynamic start and stop points. This gets the next n sets of records from a query. This example loops from the 5th through the 10th record returned by the MessageRecords query:&lt;br /&gt;&lt;br /&gt;&lt;cfset Start = 5&gt; &lt;br /&gt;&lt;cfset End = 10&gt; &lt;br /&gt;&lt;cfloop query = &quot;MessageRecords&quot; &lt;br /&gt;   startRow = &quot;#Start#&quot; &lt;br /&gt;   endRow = &quot;#End#&quot;&gt; &lt;br /&gt;   &lt;cfoutput&gt;#MessageRecords.Message_ID#&lt;/cfoutput&gt;&lt;br&gt;&lt;br /&gt;&lt;/cfloop&gt;&lt;br /&gt;&lt;br /&gt;The loop stops when there are no more records, or when the current record index is greater than the value of the endRow attribute. &lt;br /&gt;&lt;br /&gt;The advantage of looping over a query is that you can use CFML tags that are not allowed in a cfoutput tag. The following example combines the pages that are returned by a query of a list of page names into one document, using the cfinclude tag. &lt;br /&gt;&lt;br /&gt;&lt;cfquery name = &quot;GetTemplate&quot; &lt;br /&gt;   dataSource = &quot;Library&quot;&lt;br /&gt;   maxRows = &quot;5&quot;&gt; &lt;br /&gt;   SELECT    TemplateName &lt;br /&gt;   FROM Templates &lt;br /&gt;&lt;/cfquery&gt; &lt;br /&gt;&lt;cfloop query = &quot;TemplateName&quot;&gt; &lt;br /&gt;   &lt;cfinclude template = &quot;#TemplateName#&quot;&gt; &lt;br /&gt;&lt;/cfloop&gt;</description>
		<dc:creator>wlee</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2004-03-25T10:58:59</dc:date>
	</item>
	</rdf:RDF>

