I'll try to reframe this, sorry.
I want to achieve a situation, where I can define a value in the Mastersyntax and depending on this value, the inserted syntax runs different lines of code.
The goal is to set this variable once in the Mastersyntax, so I don't have to open each inserted syntax and manually adjust the code there.
I will sketch this out in pseudo code, maybe this will help clear up my issue:
Mastersyntax:
define Test as a macro with return value or variable // change the value manually, if needed
insert otherSyntaxA.sps
insert otherSyntaxB.sps
insert otherSyntaxC.sps
-------
Inserted Syntax (A, B and C):
// some code that stays the same
if (Test = OptionA) then // run different code depending on the value of Test defined in the mastersyntax
codeA
else
codeB
// some code that stays the same
if (Test = OptionA) then // run different code depending on the value of Test defined in the mastersyntax
codeA
else
codeB
// some code that stays the same
The issue I was having with the example code I gave in my last post, was that die Decision macros in the inserted syntax did not use the value of the variables !test or !t, defined when executing the Test macro in the mastersyntax. Even though I assigned the value OptionA to !t in the Mastersyntax, !IF (!t = OptionA) evaluated to false and the else clause was executed. The same for the three other configurations.
Therefore, I am wondering how I can access the value of a macro variable from the Mastersyntax in a macro situated inside the inserted syntax.
Addressing your solutions:
- Call the macro from the Mastersyntax:
The problem with calling the Decision macro in the master syntax is, that in my real case, there are several macro calls in the inserted syntax in between other lines of code. So, I would need to break the inserted syntax into multiple parts at each macro call and insert those all separately, which is not feasible.
- Call a macro in the Mastersyntax from the inserted syntax:
To use the result of this macro in the evaluation of the IF-clause, I would need a return value from the macro, right? I am not aware, how this would be possible. From my understanding Macros just run lines of code based on parameters and do not return anything like function.