Conditional Formatting
In order to change a labels color based on the value associated with it, we need to use Expressions. Each label has multiple properties that can be modified based on expressions. These Expressions are set at the specific property level.
Example: I want to change a border on my label based on a value. I would need to edit the Expression for Border Color and then create an expression that defines what conditions to look for and what colors to set based on those conditions.
Border Color Expression:
Border Color Expression Editor:
Steps To Set Label Color Using Expression
1. Click on a Label in the Detail Band
2. Find the property you wish to change based on the value and click the button on the right of the property to open the X Expression Editor. For this example the Font Color (Foreground Color) will be set based on the value.
3. Create a logical expression that will set the colors based on certain conditions. In the following expression, we check to see if the discount percent is greater than or equal to 15, if this condition is true the text will be Green. If the condition is false the text will be red.
Expression: Iif((([DiscountAmount] / [TotalCost]) * 100) >= 15,'Green' ,'Red')
Example Output:
Comments
0 comments
Please sign in to leave a comment.