Srinivasa Teja Palla wrote:
> I was doing a 
> <cfloop query="outerQuery">
> <cfloop query="innerQuery">
> <cfoutput>#outerfieldvalue# #innerfieldvalue#</cfoutput>
> </cfloop>
> </cfloop>
> outerfieldvalue is a fieldname unique to the outer query, however when I do 
> the loop, for all outerloop iterations, I noticed it brought only the first 
> row (outerquery) field value. I spent a couple of hours to realize this and I 
> had to do a workaround by declaring a new variable for this outerfield, just 
> before the inner loop. 
> 
> Can anyone confirm that this is how it is supposdto work?

Yes.


> What is the rationale behind this behaviour?

Backward compatibility.

Instead of a temp var you can use array notation:
<cfloop from="1" to="#outerQuery.recordcount#" index="i">
<cfloop from="1" to="#innerQuery.recordcoun#" index="j">
<cfoutput>#outerQuery.outerfieldvalue[i]# 
#innerQuery.innerfieldvalue[j]#</cfoutput>
</cfloop>
</cfloop>

Jochem

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

Reply via email to