How to get rid of Evaluate with Object function call

60 views Asked by At

I call a function through object at runtime. In this specific case, the function name is supplied through a logic from another page at runtime (the function exists in cfc). At present we use Evaluate and that is very slow. Any way I can get rid of this? I know I can use [] with a structure but here I am lost. qryData is the query object which I pass to the function.

<cfset someData = Evaluate("objTicket.#arrayItem[ItemID].FunctionName#(qryData)")>
<!---this is how it would look like--->
<cfset someData = objTicket.getTickets(qryData)>
1

There are 1 answers

0
rrk On BEST ANSWER

Does this fix it for you?

<cfset someData = objTicket[arrayItem[ItemID].FunctionName](qryData)>