Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
set dimX_var1 = 'val_of_var1';
set dimX_var2 = 'val_of_var2';=$(='$(dimX_var1)') --> val_of_var1 --> editor: OK --> run
='$(dimX_var1)' --> 'val_of_var1' --> editor: OK --> run
=$(dimX_var1) --> val_of_var1 --> editor: OK --> run
=$(='$(dimX_var2)') --> val_of_var2 --> editor: OK --> run
='$(dimX_var2)' --> 'val_of_var2' --> editor: OK --> run
=$(dimX_var2) --> val_of_var2 --> editor: OK --> run=if(true(),$(='$(dimX_var1)')) --> if(true(),val_of_var1) --> runI
=if(true(),'$(dimX_var1)') --> if(true(),'val_of_var1') --> fail
=if(true(),$(dimX_var1)) --> if(true(),val_of_var1) --> run
=if(true(),$(='$(dimX_var2)')) --> if(true(),val_of_var2) --> run
=if(true(),'$(dimX_var2)') --> if(true(),'val_of_var2') --> fail
=if(true(),$(dimX_var2)) --> if(true(),val_of_var2) --> run=if(match('$(dimX_var1)','comp_val')=1
,$(='$(dimX_var2)')
,$(='$(dimX_var1)')
)
--> if(match('val_of_var1','comp_val')=1,val_of_var2,val_of_var1)
--> if true --> editor: fail --> run
--> if false --> editor: Ok --> fail=if(match('$(dimX_var1)','comp_val')=1
,'$(dimX_var2)'
,'$(dimX_var1)'
)
--> if(match('val_of_var1','comp_val')=1,'val_of_var2','val_of_var1')
--> if true --> editor: OK --> fail
--> if false --> editor: OK --> fail=if(match('$(dimX_var1)','comp_val')=1
,$(dimX_var2)
,$(dimX_var1)
)
--> if(match('val_of_var1','comp_val')=1,val_of_var2,val_of_var1)
--> if true --> editor: Error --> run
--> if false --> editor: OK --> fail=if(match('$(dimX_var1)','comp_val')=1
,$(dimX_var2)
,'$(dimX_var1)'
)
--> if(match('val_of_var1','comp_val')=1,val_of_var2,'val_of_var1')
--> if true --> editor: Ok --> run
--> if false --> editor: OK --> run but wrongA field-reference mustn't be a 'string'. Therefore you may try for the calculated dimension:
if(match([$(dimX_var1)],'comp_val'),[$(dimX_var2)], [$(dimX_var1)])
Hi Marcus,
thanks for reply. I tried "all" variations with '['-brackets but nothing worked properly. Can you explain the difference or what should happen?
A (half) solution is referencing to dimX_var2 as a possible (drop-down) value for dimX_var1.
='$(dimX_var2)'Then I can define the dimension with
=$(dimX_var1)and the boxplot run like expected.
Why this is only half the way shows up, when I change the value of dimX_var2 (e.g. change weight from kilogram to milligram). Then my drop-down field of dimX_var1 empties. If I select the value in dimX_var1 again I get the correct visualisation with updated dimX_var2.
So if there was a way to auto-update dimX_var1 after changing dimX_var2 (no extra button/click), my problem would be solved.
The [] brackets respectively appropriate "" quotes are only mandatory if the field-name contained spaces or any kind of special chars - otherwise the may be skipped. If the variable-values itself are created with brackets/quotes the call of the variable mustn't be within brackets/quotes.
In some way is the variable-handling quite easy because the resolved result of a variable must only look as if the wanted content has be directly written. Therefore the simplest approach is often creating the target-object without a variable - adding quite normal the dimensions + expressions. If this is working as expected those parts which should be dynamically are replaced step by step. Because of the fact that the origin working has been proved each afterwards difference has the cause that the variable has the wrong value respectively is called with a not suitable syntax. In many scenarios it's only a matter of a few attempts to find the working ones - and I suggest to start such things always with a table-chart which has nearly no struggles to object-properties like axis and so on and enables more possibilities to add some more dimensions + expressions in parallel as the graphic-charts.
Beside of this the variable-handling could become quite tricky because there are dependencies between the ways how the variable is created (immediately evaluated or for a later evaluation) and where they is called (dimension, expression, variable, any property) again and which kind of content (string, number, field-reference, expression, variable) they have.
Apart from the above you may simplify your task by unifying the units and/or reflecting them within the expressions or the formatting.
Thanks for the explanation!
Ok, then "[" is not a problem/solution for my misunderstanding because I prefer the old fashioned way of forbidden (special) characters or blanks in names, paths, variables etc.
I also prefer to define as much as possible in the script for better maintanance. Experience to date has shown that the number of visualizations increases 'magically' due to user requests. The effort required to implement these requests while retaining the look&feel or corporate identity grows exponential. I think you know what I mean.
Normally I work/test with tables as you recommend. I don't understand why my formula doesn't work properly, but the (imperfect) half-solution will have to “do” for now.