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

Can you reference the value of an expression in Background Color properity

I'd like to avoid re-writing an expression as part of the background color statement for said expression.

For example

Expression =  Sum(A)/Sum(B)

Background Color = if( Value_of_Expression > A, Green(),

                              if( Value_of_Expression > B, Yellow(), Red() ) )

Replacing "Value_of_Expression" with the actual expression works, but it's difficult to maintend for complicated expressions.

Do alternative methods exist?

Thanks,

Ben

4 Replies
Not applicable
Author

Ben,

I am not sure if you can do that directly.

However, you can use a variable to store the expression and the condition to display the color and then call this variable in the background color property.

Hope that helps.

-Regards,

-Khaled.

Not applicable
Author

Ben,

Try something like this:

=if([Expression]>=3,Red(),Green())

where [Expression] is the label of the expresssion you are writing.

Please find the attachment.

Hope that helps.

-Khaled.

Not applicable
Author

define a variable with parameters

ColorCondition = if( $1 > $2, Green(), if( $1 > $3, Yellow(), Red() ) )

and define your expressions as variables

Share = Sum(A)/Sum(B)

and then use

$(ColorCondition($(Share), A, B))

as the expression for your color.

Not applicable
Author

You can refer directly to the name of the expression.

eg. Your expression is:

Sum(A)/Sum(B)

The expression name is:

A div B

In the background colour expression box you put:

If([A div B] > A, Green(),

  If([A div B] > B, Yellow(), Red()))