Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a pretty complex expression in a gauge chart with only one segment color. I would like to change the color of that segment if the value of my one expression is > 100. I know I can do this by using the same expression in my calculated segment color, but I don't like the overhead that comes with it. Is there a way to just reference the expression name?
Ex. =if(myExpressionName > 100, RGB(1,1,1), RGB(2,2,2))
That's fine
You don't need to create the variable in the script, just click on Settings tab / Variable Overview. Then click add and give a name to your variable, after that you can paste your expression in the definition pane. Don't forget to put a = before the expression.
Hi Adam,
What about storing the expression in a variable and then using it in your condition?
Good thought Cesar, but due to the nature of the expression, I can't create the equivalent in script execution to assign to a variable. Well, at least, I don't know how ![]()
That's fine
You don't need to create the variable in the script, just click on Settings tab / Variable Overview. Then click add and give a name to your variable, after that you can paste your expression in the definition pane. Don't forget to put a = before the expression.
Holy Cow! I was not aware I could do that!
What is the cost of using variables in this way with complex expressions? For instance:
Option 1:
I have the complex expressions in a chart that is isolated to one tab, where the calculations in the expression are only done when on that tab.
Option 2:
Assign the complex expressions to a couple variables at the document level that would be calculated in every tab after every selection.
So would Option 2 cost more processor? Or am I thinking of this in the wrong way?
When you have the expression in a variable it's re-calculated every time you make a selection whereas when you use it on an specific chart it will only calculate when the chart is displayed. So, if you need this calculation in many objects you could stick it into a variable just to ease maintenance as it would be recalculated many times anyway. So yes, I think you are right in saying that.