Help with dynamic Xecute in curly brackets
Typically, I have time to review the documentation, which I'm sure is here. However, I have a workaround (TEST1) but I was wondering if anyone could assist me in advising how I would need to adapt the curly brace snippet (TEST2) to provide the same result.
Thanks for any help you can provide.
TEST1(STATUS=1) K (STATUS) X "S MSG=$S(STATUS:""HELLO"", 1:""GOODBYE"")" W !,MSG Q TEST2(STATUS=1) PUBLIC { X "S MSG=$S(STATUS:""HELLO"", 1:""GOODBYE"")" W !,MSG }
2 possible solutions:
X "S MSG=$S(STATUS:""HELLO"", 1:""GOODBYE"")"
W !,MSG
}
X "S %MSG=$S(%STATUS:""HELLO"", 1:""GOODBYE"")"
W !,%MSG
}
see also my article Summary on Local Variable Scoping
Have you considered using $xecute?
and here is this code in action: