intersystems-cacheintersystemsintersystems-ensembleintersystems-iris

InterSystems Cache: How to store macro name in a variable then evaluate it


How can I store a macro name in a variable and then later use it?

For example:

Set myVariable = "AssertEquals"

Do $$$myVariable(...)

OR

Set myVariable = "$$$AssertEquals"

Do myVariable(...)

Thought I could do something like the following but that doesn't work either (I get CLASS DOES NOT EXIST).

Do $CLASSMETHOD("%UnitTest.TestCase","AssertEqualsViaMacro",....)

Solution

  • No way, macroses expended during compile time, but you going to use them in runtime. I think you should better explain what you actually going to achieve. And you'll get more answers if you ask here.