Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I want to assign to a variable the value of a cell line of Average.
Exemple :
Dimension value1 value2
AAAAA 10 1
BBBBB 20 1
CCCCC 30 2
AVG 20 2
The second value is calculated and i want to retrieve it.
how can I get this value ?
thanks !!
Paul
Paul,
You're calculating this average using an expression in the chart. That means, you have to use the same expression to define your variable. There are two options, depending on your needs:
1. You want this variable to be dynamic. That is, selections change - variable changes. In this case you have to define your variable in the Variables Overview as
=<expression>
2. You want to capture the value of the average at some moment, and it keeps the value until you decide to change it. In this case, create a button or a text box with action "Set Variable", with the Value
=<expression>
Hope it helps.
Regards,
Michael
Hi Paul,
If I am understanding you correctly you want to store the calculated averages into variables.
If that is the case then the approach would be something like this:
Step 1:
- Create 2 variables,say vAvgValue1 and vAvgValue2
Step 2:
- in your code
TEMP:
Load num(avg(Value1) as Value1Average,
Load num(avg(Value2) as Value2Average
RESIDENT mytable;
LET vAvgValue1 = peek('Value1Average', 0,TEMP);
LET vAvgValue2 = peek('Value2Average', 0,TEMP);
DROP TABLE TEMP;
Hope this helps
regards
Alexis