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.
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
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.
Design a simple table that contains following data from the fields in the dataset:
Refer Simple Table Design section to create above table design.
To improve the tablix design apply background color, font style to the table header by following the below steps:
Properties
icon in the configuration panel.
Refer Properties Panel section to set or edit values in properties panel.
To highlight the table rows which has the Country
value selected in parameter drop-down at runtime, follow the below steps:
Details
Row group in the tablix. Now, the common properties for selected cells will be listed in the properties panel.
BackgroundColor
property and then click on the square icon in the right corner of the respective property.
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.
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.
Download the above report design from link.