Hi Steve, Firstly, re: n-arguments, you nailed it: result = component.method(argumentCollection=mystruct);
(also a thanks to Brian Rinaldi who I bugged over Gmail and who got me the same crucial answer even faster - Thanks Brian!) Secondly, I am always loathe to give up cfscript, so you're right, a function that wraps cfinvoke is the solution. I don't know if it is worth the trouble as I think that is probably less readable than the evaluate() it replaces, but I do think it is the right solution to the question I asked and absolutely solves the problem. Many thanks for the great tips! Best Wishes, Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Bryant Sent: Thursday, June 08, 2006 10:18 AM To: [email protected] Subject: Re: [CFCDev] Help with dumping Evaluate() . . . Peter, Assuming I understand your question, I can see two approaches. 1) Give up cfscript and use cfinvoke (far more flexible for this sort of thing). 2) Create function or method that uses cfinvoke to call a generic component and method with specified arguments. For example: <cffunction name="MethodCall" access="public" returntype="any"> <cfargument name="component" type="any" required="yes"> <cfargument name="method" type="string" required="yes"> <cfargument name="args" type="struct" required="no"> <cfset var result = 0> <cfif StructKeyExists(arguments,"args")> <cfinvoke component="#arguments.component#" method="#arguments.method#" returnvariable="result" argumentcollection="#arguments.args#"> </cfinvoke> <cfelse> <cfinvoke component="#arguments.component#" method="#arguments.method#" returnvariable="result"> </cfinvoke> </cfif> <cfreturn result> </cffunction> Then, instead of this: Local.LoopReturns = evaluate("Request.#Local.Temp.Class#.#Local.Temp.Method#(Local.Temp.Paramete rs)" have this: Local.LoopReturns = MethodCall(Request[Local.Temp.Class],Local.Temp.Method,Local.Temp.Parameters ); Of course, Local.Temp.Parameters would now have to be a structure instead of a comma-delimited list. Make sense? Or did I misunderstand your problem? Steve Bryant 918-449-9440 Bryant Web Consulting LLC http://www.BryantWebConsulting.com/ http://steve.coldfusionjournal.com/ At 09:01 AM 6/8/2006, 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 parameters . 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.Paramete rs)"); > > >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.Paramete rs)"); > 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 >[email protected] 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/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] 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/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] 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/[email protected]
