Right, I tried this but it behaved weirdly - as thought the ArrayAppend were 
passing just a pointer to the one object each time so that after appending all 
my objects, the array was full replicas of whichever object was loaded last 
instead of a bunch of different objects.  To clarify, here's some code:

<CFFUNCTION name="getPrograms_a" access="public" returntype="Array">
        
        <CFINVOKE method="getPrograms_q" returnvariable="q_programs">
        </CFINVOKE>
        
        <CFSET a_programs = ArrayNew(1)>
        <CFSET o_program = createObject('component', 
'#REQUEST.cfcPathDot#.Program')>
        
        <CFLOOP query="q_programs">
                        <CFSET o_program.setProgramID(programID = 
q_programs.ProgramID)>                
                        <CFSET APPLICATION.programDAO.read(o_program)>
            <CFSET ArrayAppend(a_programs, o_program)>
        </CFLOOP>
        
        <CFRETURN a_programs> 

</CFFUNCTION>

So, when I call this function, I get an array back that has seven objects as 
I'd expect (as there are 7 programs in the database).  However, each object in 
the array has the same values in it.  If I do a dump of the of the o_program 
object just before the append in the above function, I see the different 
programs displayed individually as I'd expect.  But when I look at the Array 
that's returned in the calling page, I see seven identical programs.

Thanks again for the help


>Hi Jonathon,
>
>There's only one thisContact variable, which is being reused each time
>through the loop.  So all you need to do is put:
>
><cfset var thisContact = "">
>
>right at the start.  There's an indeterminate number of values that are
>passing through that one variable on their way into the array, but it's
>still one variable.
>
>And of course var scope returnArray and q_Contacts as well.  If you're on
>CF9 things may a little different in that you may not need to explicitly var
>scope, but I'll let the CF9 gurus pick that one up.
>
>
>Jaime
>On Thu, Jan 14, 2010 at 4:26 PM, Jonathan Price <
>[email protected]> wrote:
>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329655
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