Adding Alternate Row Colors in SQL Server Reporting Services (SSRS)

SQL Reporting Services (SSRS) is a great tool offering lots of features and ability to customize the report appearance apart from addressing complex business reporting needs. Above all SSRS is one of the components which comes free when you buy SQL Server 🙂
 
Often in Reporting and Scorecard/Dashboard projects customization/look and feel becomes one of the important aspects of the project. SQL Server Reporting Services offers various options to customize the look and feel of the report to make the report more Jazzy and Visually Appealing.
 
One of the most powerful components of SSRS is the ability to control various elements/properties of a report with the use of expressions. One of the properties which is usually set in tabular reports especially in case of really long reports with hundreds or thousands of rows is to set different colors to alternate rows.
 

To set different color (two different colors) to alternate rows, follow these steps:

  • Select the Data Row of the table in the report.
  • Go to Properties Window.
  • Under the BackgroundColor property, select expression from the drop down.
  • Enter the expression “=IIf(RowNumber(Nothing) Mod 2 = 0, “Color1”, “Color2”)” in the Expression Window.
  • In the above expression replace Color1 & Color2 with either the Color Code/Color Name as appropriate.

Below is a snapshot of a sample SSRS report with two different colors for alternate rows.

image

This customization is very useful in case of long running reports with hundreds/thousands of records having many columns where in tracking the data in one single row across all the fields becomes a little difficult/confusing if we don’t use separate colors for alternate rows.

 

Advertisements

About Dattatrey Sindol (Datta)

Datta is a Microsoft BI Enthusiast, passionate developer, and a blogger. View Full Profile

Posted on November 26, 2009, in SQL Server, SSRS, SSRS Tips, Tips 'N' Tricks and tagged , , , , , . Bookmark the permalink. 3 Comments.

  1. This is exactly I was looking for!Very useful info…Keep up the good work Datta 🙂

  2. Thanks Rajesh.Glad that it helped you…

  3. Clear and to the point instructions.Thanks for posting this.

What are your thoughts?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: