Conor
Conor

Reputation: 107

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",....)

Upvotes: 0

Views: 149

Answers (1)

DAiMor
DAiMor

Reputation: 3205

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.

Upvotes: 2

Related Questions