This code
<cffunction name="onApplicationStart">
<cfset application.api = {tst= createObject( "component", "com.Test" )} />
<cfreturn true />
</cffunction>
defines the variable application.api.tst
. You want define a variable by calling a method in this object (CFC).
You can define the variable list
in two ways:
<cfinvoke component="#application.api.tst#" method="doSomething" returnVariable="list" />
as Sean describes or by using a simple CFSET
<cfset list = application.api.tst.doSomething() />
The value of list
is based on whatever was returned by the function doSomething
, which is a public function inside the component com.Test
that exists in the application variable.
You should be able to output of CFDUMP
the value of list
at this point. If the variable does not have the value you expected, then you need to verify what the function doSomething
is returning.
but I am getting the error"!
– Peter Boughton Apr 02 '14 at 19:17