Here is a fun one that I somehow missed in the past...

We were looking at some code that appeared to be looping over itself and
tracked it down to an extraneous <CFOUTPUT> clause inside the parent
<CFOUTPUT QUERY..> loop.
 
Here is a quick example:

<cfoutput query="getItems">
#getItems.itemId#<br>
</cfoutput>
 
Outputs the item id numbers as expected..
IE:
1
2
3
4

Now try this:
 
<cfoutput query="getItems">
<cfoutput>#getItems.itemId#</cfoutput><br>
</cfoutput>

The second version outputs a loop of the items in a loop of the records.. 
IE:
1234
234
34
4

Although this does make some sense, it seems strange that the second
cfoutput is indeed interacting with the parent cfoutput loop but not like
one might expect.

Of course the obvious solution is to avoid extraneous CFOUTPUTs, but I
thought it might be helpful to post in case anyone else encounters a similar
issue in the future. 

This behavior occurs in both CFMX 7 and CFMX 8 FWIW.

Nothing earth shattering here.. Just one of those nuances that makes you
feel a little crazy from time to time. ;)

For fun, can anyone come up with a scenario where this type of behavior is
actually DESIRED instead of both outputting the same results like might be
expected?

Todd



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288757
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to