Friday, August 31, 2018

Conditional Formatting with Expression

The following code can be used in the background property in SSRS for a field to change the color.  In this example I am changing the background color of a Totals field based off of another field (School.)

So if the School field = "District" then I want the Total Field to be Yellow, If it equals Secondary then I want it to be Red and Finally if it equals Elementary I want the field to be Blue

1. In Design View for your report, click on the Textbox you want the colors to be used.
2. Find the Background Color under Fill in the Properties.
3. Select the dropdown for background color and choose Expression
4. Use the code below as a starting point for your conditional Formatting.

=Switch(Fields!School.Value = "District", "Yellow", Fields!School.Value = "Secondary", "Red",Fields!School.Value = "Elementary", "Blue")

No comments:

Post a Comment