Title: Message
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 11:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

How do i use argumentCollection? is there some kinda collection available in CFMX like Java Collections?
 
Thanks,
Joe
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Nathan Dintenfass
Sent: Wednesday, June 18, 2003 1:21 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

If you want to pass the argument names dynamically, I suggest you use the argumentCollection
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 8:13 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

 
Thanks Nathan,  I knew.. there was a way around the "evaluate"....
It was really bothering me.. to advocate NOT to use "evaluate" and
having forced to use it.
 
One more question.. havent tested it..
Can i pass the parameters in
value= variables[objName].dynMethod(request.param1,request.param2);
 
Thanks
Joe Eugene
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Nathan Dintenfass
Sent: Tuesday, June 17, 2003 6:19 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

A similar method, if you need the dynamically called method to have access to the CFC internals might be:
 
<cfscript>
object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 variables[objName].dynMethod = variables[objName][methodName];
 value= variables[objName].dynMethod();
 writeOutput(value);
</cfscript>
 
In the original, you are "stripping" the method off the CFC instance and making it local.  In my method you are "tacking" the dynamic method back onto the CFC instance.  It only matters if the method you call also calls private/public methods of the CFC and/or uses instance data of the CFC.
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Adam Cameron
Sent: Tuesday, June 17, 2003 2:57 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

This works (tested):
<cfscript>
 object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 dynMethod = variables[objName][methodName];
 value= dynMethod();
 
 writeOutput(value);
</cfscript>
 
Is that what you're after?
 
Adam Cameron
Application Developer
Straker Interactive

[EMAIL PROTECTED]
Fax + 64 9 3605870
DDI +64 4 4965664

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Eugene
Sent: Wednesday, 18 June 2003 7:59 a.m.
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Dynamic CFC Calls

Thanks Samuel... but that does NOT work.
 
The only way i can get it to work is using an evaluate.... and i really dont want to use "evaluate"
 
 variables.execMethod="request."&variables.varClass&"."&variables.varMethod;
 '#variables.varName#'= evaluate(variables.execMethod);
 
Your Code...
 variables[varName] = request[variables.varClass][variables.varMethod](); // Complains about "()"
 
The compiler complains about the "()" at the end... can u get it to work?
 
Thanks
Joe Eugene
 
 
 
----- Original Message -----
Sent: Tuesday, June 17, 2003 3:45 PM
Subject: RE: [CFCDev] Dynamic CFC Calls

two ways, 
 
1.
 
request.dataObj = createObject("Component","Website/MyData");
 
varObj="dataObj";
varMethod="getStateData"; // removed the parens
varName="someData";
 
variables[varName] = request[varObj][varMethod]();
 
2.
 
<cfinvoke component="#request[varobj]#" method="#varMethod#" returnVariable="#varName#">
 
 
Untested but both should work.
 
hth,

Sam
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 3:38 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Dynamic CFC Calls

Anybody know how to dynamically call methods in CFC's
 
<cfscript>
request.dataObj = createObject("Component","Website/MyData");
 
varObj="dataObj";
varMethod="getStateData()";
varName="someData";
 
 
// Now, i want to be able to call the CFC Dynamically, something like
 
'#varName#'=request["#varObj#"]["#varMethod#"];
 
//.#varMethod# doesnt work either.
 
</cfscript>
 
I am getting the below from the above code.
"Element getleftNavLinks is undefined in a Java object of type class coldfusion.runtime.TemplateProxy referenced as"
 
What am i missing?..
 
Thanks
Joe Eugene

Reply via email to