Looks to me like you need a row number in your query call.... Consider this
code:

local["qryItems"]["id"]) 

This will always get the first row - yes? Since you are in a loop...
Shouldn't this be just id (wich would give you
local.qryItems['id'][currentrow]).

I would also say that you better have a darn good reason for doing it this
way... It's pretty confusing :) 


-Mark 


Mark A. Kruger, CFG, MCSE
(402) 408-3733 ext 105
www.cfwebtools.com
www.coldfusionmuse.com
www.necfug.com

-----Original Message-----
From: Don [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 03, 2008 3:52 PM
To: cf-talk
Subject: Cf8 bug?

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:314788
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