Search results
Suggest a FeaturePDF

Conditional Formatting

Conditional formatting can be used to enhance the visual appearance of the tablix data region in the report design. In this section, basic report design to configure conditional formatting in a tablix data region is explained step by step.

Create dataset

To bind data to the tablix data region, create a dataset in your report. In this section, the following query is used to fetch customer details data from Customers table in NorthWind database.

Select CustomerID, CompanyName, Address, City, PostalCode, Country From Customers

Open group menu

Create parameter

To apply conditional formatting based on report parameter, create a parameter in your report. Refer Create Parameter and Define Available Value section to create and assign value to the parameter. In this section, the FormattingRow parameter is created and assigned Country data field as query value. Refer the below snaps for better understanding.

New parameter creation

Open group menu

Assign value

Open group menu

Parameter list view

Open group menu

Add table data region

Design a simple table that contains following data from the fields in the dataset:

  • CustomerID
  • CompanyName
  • City
  • PostalCode
  • Country

Open group menu

Refer Simple Table Design section to create above table design.

Formatting table

To improve the tablix design apply background color, font style to the table header by following the below steps:

  1. Select the first row of table and click on the Properties icon in the configuration panel. Open group menu
  2. Set font color, font style and background properties for header row as shown below. Open group menu

Refer Properties Panel section to set or edit values in properties panel.

Apply conditional formatting

To highlight the table rows which has the Country value selected in parameter drop-down at runtime, follow the below steps:

  1. Select the Details Row group in the tablix. Now, the common properties for selected cells will be listed in the properties panel. Open group menu
  2. In the properties panel select BackgroundColor property and then click on the square icon in the right corner of the respective property. Open group menu
  3. Click on Expression menu to open the expression builder. Set the following conditional expression in the text area, =IIf(Fields!Country.Value=Parameters!FormattingRow.Value,"#e2f2bf","Transparent") and click on the OK button. Open group menu

Preview report

On report preview, select the country in the parameter drop-down and click on the View Report button. Now, based on the selected country the rows which contains the selected country name will be highlighted as shown below.

Open group menu

Download the above report design from link.