I want to have an array in a component that gets stored in the GAE
datastore. I get an error with the following code saying that
variables.myarray is not an array when I try to call the addToArray
function.

<cfcomponent  name="testObj" output="false">

<cfset variables.myarray = arraynew(1)>

<cffunction name="addToArray">
<cfset arrayappend(variables.myarray,"Test")>
</cffunction>

</cfcomponent>

If I add this init function to the component and and call it when I
create the object, then the component works:

<cffunction name="init">
<cfset variables.myarray = arraynew(1)>
<cfreturn this>
</cffunction>

Is this the expected functionality? or should I be able to set
variables.myarray in the component outside of a function?

Thanks,
Adam

-- 
official tag/function reference: http://openbd.org/manual/
 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to