Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Coloring of Text in a Text Box. (make negatives red)

Text Box Display Formula: Expression using the contents of two other text boxes

Font Color Formula: IF (Expression > 0, green, red)

I use this method in my dashboard but it means that the entire expression has to be copied into the Font Color formula.  The issues I have with this are:

1) Doesn't this affect performance because the formula has to be calculated twice? Once for the expression to be displayed in the text box and once for the text color?

2) Is there a way of referring to other calculations in other text boxes like you can in a Table Box.  I have found that changes have been made to the expression that displays but those changes were not put into the color formula also.  It would be nice if there was a "Current Expression Value" function or the ability to refer to another object like you can with a column.  ie. if [Budget] - [Sales] >0, green, red.  That way any changes in the Budget calculation would then be seen by the font color expression.  Any ideas?


3 Replies
danieloberbilli
Specialist II
Specialist II

You could write the expression once in a variable e.g.

vVar  =   sum(sales)

if($(vVar)>0,green(), red())

Anonymous
Not applicable
Author

1. Expression results are cached.  That means if two expressions are exactly the same, they are calculated once, not twice.  But if they are even a little different (sum in one but Sum in another) - each will be calculated.

2. Not exactly - but think of keeping expressions in variables.  So, the variable eBudget contains expression for Budget calculations, and variable eSales - for Sales calculations.

Hope this will help you.

krishna20
Specialist II
Specialist II