Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Putting Dollar Expansion in Variable

Hi

I am setting a variable in the script for use later in Set Analysis, but have had issues with the Dollar Expansion;

As in, this don't work :

let vSetMTYesterday='[Day]={"<=$(=day(today()))"} ';

But replacing the $ with ' & chr(36) & ' then it does work :

let vSetMTYesterday='[Day]={"<=' & chr(36) & '(=day(today()))"} ';

Is this what one would expect ?

Is there a better way of doing this ?

Best Regards,     Bill

4 Replies
Not applicable
Author

Hi,

I have the same problem with one of my applications. Try this :

SET vSetMTYesterday = '[Day]={"<=%(=day(today()))"} ';

LET vSetMTYesterday = Replace($(vSetMTYesterday), '%', '$');

It works for me.

Anonymous
Not applicable
Author

Marie-Sophie

Many thanks for your suggestion which is a different swerve on mine, as in you avoid the $ by using a % and later replacing the % with a $, whereas I use chr(36) that translates to the $ sign.

I'd be interested to hear if we just have live with a frig for this or whether there is a neat, tidy & elegant solution.

Best Regards,     Bill

Gysbert_Wassenaar

This should work too: LET vSetMTYesterday= '[Day]={"<=$' & '(=day(today()))"}';

Sometimes the above is the easiest way to handle this, sometimes a SET and LET + replace is more convenient. It depends for example on how many $ characters you need to 'escape'. But it is something you have to live with. Dollar-expansion is very nice to have, even if it does mean that sometimes you need to do a bit extra to prevent a premature expansion.


talk is cheap, supply exceeds demand
rustyfishbones
Master II
Master II

Can you not just say

LET vMTDYesterday = TODAY()-1;