Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a problem with using the content of a field as a variable name that needs to be expanded.
Consider this situation:
In the script i set these (i want the users to be able to play with these values)
LET vNiveau1Factor = 10;
LET vNiveau2Factor = 20;
LET vNiveau3Factor = 30;
LET vNiveau4Factor = 40;
INLINE table:
Niveau | Factor |
---|---|
Niveau 1 | vNiveau1Factor |
Niveau 2 | vNiveau2Factor |
Niveau 3 | vNiveau3Factor |
Niveau 4 | vNiveau4Factor |
CHART
Dimension (Niveau) | Expression 1: =Factor | Expression2: ????? |
---|---|---|
Niveau 1 | vNiveau1Factor | I would like to have an expression here that shows 10 (or current value) |
Niveau 2 | vNiveau2Factor | I would like to have an expression here that shows 20 (or current value) |
Niveau 3 | vNiveau3Factor | I would like to have an expression here that shows 30 (or current value) |
Niveau 4 | vNiveau4Factor | I would like to have an expression here that shows 40 (or current value) |
I would like Expression2 to show the actual value of the variables.
I can't seem to find the correct $-expansion for this case.
=$('=Factor') doesn't work....
Could any1 shine a light on this?
Thanks
Herbert
Hi,
in inline table add one more colum say Value then pass those
vNiveau1Factor
vNiveau2Factor
vNiveau3Factor
vNiveau4Factor
Declare variables in front end..
please check rough example fr how to pass variable to inline load
Thanks
//Script
LET vNiveau1Factor = 10;
LET vNiveau2Factor = 20;
LET vNiveau3Factor = 30;
LET vNiveau4Factor = 40;
Data:
Load
Niveau,
Factor
Inline
[
Niveau, Factor
Niveau 1, vNiveau1Factor
Niveau 2, vNiveau2Factor
Niveau 3, vNiveau3Factor
Niveau 4, vNiveau4Factor
];
Create a table
Dimension
Niveau
Expression
1)
Factor
2)
Pick(
Match(Niveau,'Niveau 1','Niveau 2','Niveau 3','Niveau 4'),
'$(vNiveau1Factor)','$(vNiveau2Factor)','$(vNiveau3Factor)','$(vNiveau4Factor)'
)
Manish solution works, But bit long as per my experience if we have 30 Variables then we may need to create Long Expression.
May be another solution with Inline Memory
LET vNiveau1Factor = 10;
LET vNiveau2Factor = 20;
LET vNiveau3Factor = 30;
LET vNiveau4Factor = 40;
Data:
Load * Inline
[
Niveau, Factor, Factor1
Niveau 1, vNiveau1Factor, "$(vNiveau1Factor)"
Niveau 2, vNiveau2Factor, "$(vNiveau2Factor)"
Niveau 3, vNiveau3Factor, "$(vNiveau3Factor)"
Niveau 4, vNiveau4Factor, "$(vNiveau4Factor)"
];
Create Straight Table
Dimension -- Niveau, Factor
Expressions are
1) Sum(Factor1)
This works up to a point, if I use an inputbox to change the value of the variable, somehow the "$(vNiveauXFactor)" does not change with it.
I got it to work using the pick-function.
Which isn't really what I was looking for, but it works and is straightforward.
Thanks for all your answers.
Hi,
if being able to change the value during runtime is the reason for using variables in the first place, then you might as well consider using Inputfields instead.
hope this helps
regards
Marco