Exforsys

Home arrow Reviews arrow SQL Server Reporting Services

Report Builder 2.0 - Format a Column

Author: Packt Publishing     Published on: 9th Jun 2009

Format a column based on some criterion

In the above report in the third column, there is a wide variation in the value of the rows. The purpose of this is to demonstrate using a condition in the expression. This section shows how you may use the Expression to set the color of that textbox based on the value it contains when you run the report.

Ads

1. In the design of the report, select the textbox for the Third (third row second Column).

2. Right-click to access the textbox's properties.

3. In the Text Box Properties window, click on the navigation item Fill.

4. In the Fill page, click on the symbol fx to open the Expression window for the Fill Color.

5. In the Expression window, type in the expression as shown in the following screenshot.

This screenshot has two windows superposed. By using this expression you are changing the background color of the textbox. The expression contains the value that will appear in the textbox. Now you are using the Program Flow function in the Expression window to coin the expression. The syntax of this function is also displayed in the Expression window. The expression contains a nested IIF function. If the value is greater than or equal to 10, the background will be Blue otherwise the color will depend on another condition. If the value is greater than or equal to 1, (must be less than 10 because of nesting) it will be Yellow. If less than 1 it will be Red.

6. Click on the OK button in the Expression window and also on the OK button in the Text Box Properties window.

Ads

7. Run the report from the "ribbon".
The report gets displayed as shown in the following screenshot:



 
This tutorial is part of a SQL Server Reporting Services tutorial series. Read it from the beginning and learn yourself.

SQL Server Reporting Services

 

Comments