Title: Message
If you need to pass n ordered parameters, I'm not sure if there is a solution.  But if can be a structure of name value pairs this method should do what you want

Local.TempReturns = dynamicMethodCall(object=Request[Local.Temp.Class], method=Local.Temp.Method, args=Local.Temp.Parameters);

<cffunction  name="dynamicMethodCall" access="public" returnType="any" 
      hint="method to dynamically call any method on any object with any arguments">
   <cfargument   name="object"  required="true" type="any"   hint="a reference to the object to call the method on" >
   <cfargument   name="method"  required="true" type="string"   hint="the name of the method" >
   <cfargument   name="args"  required="false" type="struct" default="" hint="a structure with the arguments as name value pairs" >
   <cfset var retVal = false>
   <cfinvoke component="#object#" method="#method#" argumentcollection="#args#" returnvariable="retVal">
   <cfreturn retVal>
</cffunction>





Peter Bell wrote:
Hi There,
 
Reforming evaluator needs assistance *grin*. I have a loop that generically makes n-function calls which are pulled from a database table. Each function call can be to a different method of a different service using  n-different parameter. I'm within a cfscript block and loathe to go back to regular cf syntax. How do I do the following without my (nasty!) evaluate?
 
   Local.TempReturns = evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Parameters)"); 
 
If it helps, the context is:
  Local.LoopCount = 1;
  Local.LoopError = 0;
  Do
  {
   Local.Temp.Step = ListGetAt(Local.ProvisionerStepList,Local.LoopCount);
   Local.Temp.Class = Local.Parameters[Local.Temp.Step].Class;
   Local.Temp.Method = Local.Parameters[Local.Temp.Step].Method;
   Local.Temp.Parameters = Local.Parameters[Local.Temp.Step].Parameters;
   Local.LoopReturns = evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Parameters)");
   Local.LoopError = Local.LoopReturns.Status;
   ReturnStruct.Message = ReturnStruct.Message & "<br>" & Local.LoopReturns.StatusMessage;
   Local.LoopCount = Local.LoopCount + 1;
  }
  While (Local.LoopCount LTE ListLen(Local.ProvisionerStepList) AND NOT Local.LoopError);
The problem I'm solving is the ability to call n-provisioning steps pulled from a database so I can allow a non-technical user to modify the provisioners they want run, with a catch that every provisioner returns status and no more provisioners should be run on any one of the provisioner calls failing.
 
Any help much appreciated!
 
Best WIshes,
Peter
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

Reply via email to