Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I have variable For Ex:
vTest
Value for the above variable is sum({<Cntry = {'IN'}>}Sales) + sum({<Cat= {'ABC'}>}Amt)
Now I need to use that variable in some other place like
sum({<Cntry = {'IN'},Prd {1}>}Sales) + sum({<Cat= {'ABC'},Prd {1}>}Amt), so here I am adding one more with ""Prd {1}""
But I have to use only like $(vTest) and need to incude ""Prd {1}""
How can we use like above, IF condition should not be used
-Priya
You could use a variable with parameter like this one:
vTest
sum({<Cntry = {'IN'}, Prd = {$1} >}Sales) + sum({<Cat= {'ABC'}>}Amt)
and then you could use the variable as expression like:
=$(vTest(1))
or
=$(vTest('*'))
- Marcus
Can you explain the scenario?
e.g. do you need the different variables on different sheets?
You could always add a variable called say v_Prd and set this to 1 or '*' by using some trigger that works in your particular scenario
You could use a variable with parameter like this one:
vTest
sum({<Cntry = {'IN'}, Prd = {$1} >}Sales) + sum({<Cat= {'ABC'}>}Amt)
and then you could use the variable as expression like:
=$(vTest(1))
or
=$(vTest('*'))
- Marcus
Give a try on the below:
Declare variable vTest as below:
if($1=1,
sum({<Cntry = {'IN'}>} Sales) + sum({<Cat= {'ABC'}>} Amt)
,
sum({<Cntry = {'IN'},Prd ={'1'}>} Sales) + sum({<Cat= {'ABC'},Prd ={'1'}>} Amt)
)
Now you can use the above in a expression like below:
Expression:
$(vTest(1))
If you want to use the second expression in the vTest then as below:
$(vTest(2))
Hope this helps....
The option given by Adam is a good otion.
There is also the possibility to use a parametrized variable like:
sum({<Cntry = {'IN'}, $1>}Sales) + sum({<Cat= {'ABC'}, $1>}Amt)
And call the variable like:
=$(vTest(Prd={1}))
Not tested by I did something similar and the $1 doesn't gives an error when the variable is called just with "=$(vTest)", in case Prd has some null values and you don't want to exclude them.