Skip to main content

Adressing functions dynamically

Hi Brian,
your website has been really succesfull in helping me out with several IDEA issues. Thank you so much. However, I didn't find so far a solution to call functions dynamically (Call functions with the names: Function1, Function2, Function3 ...). Therefore I wanted to ask, whether you know a function (similar to VBA Excel's Eval) for sth like this (see also file):
Dim CurrentFunction as String
For Counter=1 to 5
CurrentFunction= "Function" & Counter
Call Eval(CurrentFunction)
Next Counter
This is just a general example, as I want to apply this to most of my scripts. Thank you in advance.
Regards
Johannes
 

Brian Element Mon, 12/19/2016 - 19:18

Hi Johannes,

I am glad you are finding the site useful :-).  Unfortunately IDEAscript does not allow you to do what you want (at least I have never been able to figure it out).  I would also enjoy having something like this which exists in other languages but to the best of my knowledge you can not do this in IDEAScript.  All the function names have to be hard coded and you can't access them through variable names.

Sorry.

Brian

Johannes Tue, 12/20/2016 - 03:00

Hello Brian,
Thank you for your quick response. Then I have to write it out fully. :)
Regards
Johannes