4

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)>
CFML_Developer
  • 1,565
  • 7
  • 18
  • 1
    For future readers, I'll also include http://blog.adamcameron.me/2013/08/evalulate-is-really-slow-is-it-now.html. – Shawn Oct 08 '20 at 15:13

1 Answers1

7

Does this fix it for you?

<cfset someData = objTicket[arrayItem[ItemID].FunctionName](qryData)>
rrk
  • 15,677
  • 4
  • 29
  • 45