BYJ_wntrsnt
2009-02-18 18:23:05 UTC
I'm passing a structure into a cfc using cfinvoke. I use argumentcollection
attribute of the cfinvoke to pass this structure to my cfc (I don't know any
other ways to do this, are there alternative?)
After doing some reading, I was able to pass my structure as explained in the
code below.
My question is: Since all the arguments are now of type string then within my
cfc I have no strcuture anymore, am I right?
If I still want to use a structure on my further coding I need to assemble a
structure again using all the arguments that were passed??????
<cfset var result = "">
<cfset var myStruct = structNew()>
<cfset myStruct["a"] = 1>
<cfset myStruct["b"] = 2>
<cfset myStruct["c"] = 3>
<cfinvoke argumentcollection="#myStruct#" component="Comp2"
method="handleArgCollection"
returnvariable="result" />
Within the cfc these are what I have:
<CFFUNCTION name="handleArgCollection">
<cfargument name="a" required="yes" type="string">
<cfargument name="b" required="yes" type="string">
<cfargument name="c" required="yes" type="string">
If I do something with myStruct, I got an error since myStruct is no longer
exist (?)
So if I want to work with these argument parameters as a strcuture within this
function do I have to re-create
a structure again using all those arguments???????
</CFFUNCTION>
attribute of the cfinvoke to pass this structure to my cfc (I don't know any
other ways to do this, are there alternative?)
After doing some reading, I was able to pass my structure as explained in the
code below.
My question is: Since all the arguments are now of type string then within my
cfc I have no strcuture anymore, am I right?
If I still want to use a structure on my further coding I need to assemble a
structure again using all the arguments that were passed??????
<cfset var result = "">
<cfset var myStruct = structNew()>
<cfset myStruct["a"] = 1>
<cfset myStruct["b"] = 2>
<cfset myStruct["c"] = 3>
<cfinvoke argumentcollection="#myStruct#" component="Comp2"
method="handleArgCollection"
returnvariable="result" />
Within the cfc these are what I have:
<CFFUNCTION name="handleArgCollection">
<cfargument name="a" required="yes" type="string">
<cfargument name="b" required="yes" type="string">
<cfargument name="c" required="yes" type="string">
If I do something with myStruct, I got an error since myStruct is no longer
exist (?)
So if I want to work with these argument parameters as a strcuture within this
function do I have to re-create
a structure again using all those arguments???????
</CFFUNCTION>