Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have tried to move a variable that I have in one app from the GUI to the script.
It is a variable that can only be filled on the GUI as it uses the user's selections. In principle it works - I need double >> = << and a SET for that, I've done it before - but for some reason, there is a set_expression Year={$(=max(Year))} - when I define the variable in the script with the SET statement and double >> == <<, I can see it in the variable_viewer and it looks all right, only that set_expression then reads >> {<Year = {}>}.
I have tried with a variable to simply mirror the selection on the YEAR field and that works fine - it seems to be that $(). I remember that does not work in the script. So I need to find a way around that.
I am experimenting with concatenating that as a string from various elements. I just haven't hit the right one yet.
Can somebody lend me a hand with that, please?
Thanks a lot!
Best regards,
DataNibbler
You can look here
Stop Dollar Sign Expansion in the script (Escape Character ??? )
The gist of it is that $-sign expansion is performed immediately everywhere it is encountered. In the script, this means even before the statement is parsed and executed, so that things like actually do work
SET SETthatISaLET = LET;
$(SETthatISaLET) var = Today(); // Will contain todays date
But that also means that in order to have delayed (second-level) $-sign expansion, you have to resort to $-sign camouflaging. Which means breaking the structure of a $(...) construct so that the script statement processor won't see it as a $(...) construct, but the end-result will still contain a $(...) construct.
There are multiple ways to get delayed expansion (meaning "not in the script execution, but later on when variables are actually used"), amongst them the Replace trick from the article that Sunny linked to.
IMHO the easiest one is to use explicit string pieces and separate the $ character from the parentheses. Like
LET vDelayed$Sign = '=$' & '(=Today())'; // Concat after preprocessor hasn't found a $-sign exp.
or
LET vDelayed$Sign = chr(36) & '(=Today())'; // Concat after preprocessor hasn't found a $-sign exp.
Best,
Peter
BTW $-sign expansion does work in a Load Script. But in your situation it works too early.