Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following sameple LOAD script, where I am loading amounts in 3 currencies. I want to allow the user to select the currency being reported by selecting the ReportCurrency value in a list box (with Always One Selected Value set).
Currency:
LOAD * INLINE [
DisplayCurrency,ReportCurrency
EUR, eur
USD, usd
GBP, gbp
];
Deals:
LOAD * INLINE [
amount_gbp, amount_usd, amount_eur
100,150,110
200,300,220
];
SET Vol = '=SUM(amount_$(ReportCurrency))';
The YTDVol script variable seems to evaluate at script run time and does not recognise $(ReportCurrency). If I create a Document Variable as:
=
SUM(amount_$(=ReportCurrency))
this works OK in chart expressions, but not if I use the Vol variable set in the load script.
I've tried various syntaxes without luck yet. Can anyone help?
Thanks
Dan
Try this:
SET Cur = 'amount_' & $(ReportCurrency);
SET Vol = sum(Cur);
Regards,
Hi
I'm afraid not. The $(ReportCurrency) still seems to be evaluated during script load. If I look in the Variables viewer, The Cur variable shows as 'amount_'&
Oops, my mistake, posted my reply without realizing that ReportCurrency is a field, not a variable. So of course variable expansion won't work. You can't load this in the script unless you define which value of ReportCurrency you want to use. Or do you want to cycle through all the values and have a variable hold the sum of each?
Ideally I just want one variable for Volume. I was wondering if I could use Only(ReportCurrency) instead of variable expansion.
No, this won't work in the load script. The Only function is for expression use primarily. You would still need to define which value of ReportCurrency you want to use for the variable.
Hello,
You can use something similar to
in the script.SET Vol = 'SUM(amount_' & GetFieldSelections(ReportCurrency) & ')';