Perhaps you've ran into this before. Within a cfc I'm simply looping over a 
query object and using the ID value from the query to call an external cfc 
method that eventually calls a method contained within the same CFC as the code 
below appears.

The problem is that using dot notation or array syntax I'm getting strange 
behaviour. It seems that while I've created an array [ daNums ] that shows on 
output that the right number IS being returned and USED, that when I use that 
same ID value to retreive my object, its returning the same object for each 
iteration of the loop. 

for example the first time through it gets a value of (1) which corresponds to 
an particular object, then (2). But with the code below I am always getting 
(2)(2). Not (1)(2). Or when I use array notation I always get [1][1]. For some 
reason it seems things are not iterating properly.

Is this because in the object creation call the method that eventually gets 
called to create the object exists within the same cfc as this code?

                <cfquery name="local.qryItems" 
datasource="#application.datasource#">

                        select  *
                        from    items
                        
                </cfquery>
                
                <cfset local.items = arrayNew(1)>
                <cfset local.daNums = arrayNew(1)>

                <cfloop query="local.qryItems">
                        
<!--- this code always returns (2)(2) --->
                        <!---
                        <cfset obj = 
application.cfcs.items.itemGateway.getItemObject(local.qryItems.id)>
                        <cfset arrayappend(local.daNums, local.qryItems.id)>
                        <cfset arrayappend(local.items, obj)>
                        --->
                        
<!--- this code always returns (1)(1) --->                      

                        <cfset arrayappend(local.daNums, local.qryItems.id)>
                        <cfset arrayappend(local.items, 
application.cfcs.items.itemGateway.getItemObject(local["qryItems"]["id"]) )>
        
                </cfloop>       

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314787
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to