If I understand the question... Some thing like this? http://mgt.pastebin.com/f9702565
It uses Evaluate for which I have been scolded for... but performance wise there is very little difference between evaluating the string and calling the methods directly HTH G On Fri, Oct 24, 2008 at 5:39 PM, Andy Matthews <[EMAIL PROTECTED]>wrote: > Got the answer from a coworker, which is to put parens on the varname like > so: > > <cfdump var="#result()#"> > > ----------------------------------- > > I've got a CFC which I'd like to use dynamically. Pass in a string, and > call a method with the same name as the string being passed in. I've almost > got it working with this line: > > <cfset var result = VARIABLES['method' & ARGUMENTS.method]> > > But rather than get the result of the method, I'm getting the method itself > as a variable. I can accomplish this using cfinvoke, but I'd rather use > CreateObject as I think it's a little more elegant. Can anyone suggest a way > I can get the result of the method using CreateObject? > > <!--- the calling template ---> > <cfset cfc = CreateObject('component','dynamicMethods')> > <cfset get = cfc.callMethod()> > > <!--- the CFC ---> > <cfcomponent displayname="dynamic methods" hint="dynamic method testing"> > <cffunction name="Init" output="false" access="public" > returntype="dynamicMethods"> > <cfreturn THIS> > </cffunction> > <cffunction name="callMethod" output="false" access="public" > returntype="void"> > <cfargument name="method" required="false" type="string" > default="One"> > <cfset var result = VARIABLES['method' & ARGUMENTS.method]> > <!--- <cfinvoke component="#THIS#" > method="method#ARGUMENTS.method#" returnvariable="result" /> ---> > <cfdump var="#result#"> > <cfabort> > </cffunction> > <cffunction name="methodOne" output="false" access="public" > returntype="string"> > <cfreturn 'methodOne method call'> > </cffunction> > </cfcomponent> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314368 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4