I've managed to create the following reusable expression in the Document's Variable Overview editor but I can't work out how to define it using a LET/SET statement in the load script. The problem is the requirement for single quotes arount the $1 argument. I've tried every alternative for avoiding literal quotes that I can think of but nothing works. Can anyone help?
The expression takes an argument, eg "Reprocessed" and adds the postfix in the variable "vShowDays" ("14" or "60") to get the actual dimension name, eg "Reprocessed14". It then sums it, converts to % and wraps the result in "(result%). It works perfectly when created in the Variable Overview editor, I just can't find a way to define it in the load script?
That resuilts in: Chr(40)&Round(100*Sum()/Sum(ServiceRequests),1)&Chr(37)&Chr(41) ie null inside first Sum().
I think this is because the single qiuotes are interpreted as string delimiters so we have two strings with a naked $1 in between. The $1 and the enclosing $ expansion are both evaluated during the LET assignment and since $1 is not defined the $ expansion results in null. The key problem seems to be that there is no way to prevent $ expansions from being evaluated during a SET/LET.