EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials SSRS Tutorial SSRS Alternate Row Color
Secondary Sidebar
SSRS Tutorial
  • SSRS Basic and Advanced
    • What is SSRS?
    • SSRS Versions
    • SSRS Cascading Parameters
    • SSRS Parameter
    • SSRS Group
    • SSRS Alternate Row Color
    • SSRS SQL
    • SSRS Subreport
    • SSRS Lookup
    • SSRS LookUpSet
    • SSRS Date Format
    • SSRS Report Builder
    • SSRS ISNULL
    • SSRS Opinion Panel
    • SSRS linked report
    • SSRS DateDiff
    • SSRS Dashboard
    • SSRS IIF
    • SSRS Reports
    • SSRS Number Format
    • SSRS Page Break
    • SSRS multi-value parameter

SSRS Alternate Row Color

SSRS Alternate Row Color

Introduction to SSRS Alternate Row Color

Enabling alternate row colors in SQL Server Reporting Services (SSRS) is a key visualization setup for end-users to quickly examine their views and gain greater reading accessibility for users and an aesthetically beautiful report. To retrieve the row’s position, use the Row Number() method, adjust the background color, or use the Running Value() function. The running total is the sum of all non-zero integer numbers. For example, utilize the Running Value procedure to construct a Total Running Column in SSRS.

Overview of SSRS Alternate Row Color

To check for alternate rows, we’ll need to utilize a condition. Because of this, we’ll be taken to the Data Source Properties dialogue box. Next, enter your data source’s name in the Name field of the Data Source Settings dialogue box’s Navigation pane, and choose “Microsoft Azure SQL Database” as the connection type from the drop-down option. Then, on the right-hand side, click the Build button.

  1. Enter Localhost as your Server name on the “Connection Properties” page.
  2. Choosing information for your report.
  3. To use it as a dataset query, open the Query Designer, change the Edit as Text setting to Text, and then type the expression. A dataset could be taken of our choice.

Steps to be followed

To change the tone of the alternate row, do the preceding:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

  1. First, pick the Home tab, the Text Formatting group, and the Alternate Row Color drop-down arrow in the Text Formatting group.
  2. Pick the Home tab, the Text Formatting group, and the Alternate Row Color drop-down arrow in the Text Formatting group.
  3. Choose a color from the drop-down option, or eliminate the additional row color by selecting No Color.
  4. The color of the alternate row will be changed.

Let’s see the process in detail:

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,629 ratings)

Following is the initial process to go with:

A new expression window will open after users click the Expression link. Look for alternate rows using this expression pane. We can use any colors we like. For example, to modify the background color, rather than picking each column value a little at a time, we might choose the entire row, updating them all at once. Scroll down and fill the Properties window once the full row has been selected.

This is where BackgroundColor is found. We need a different phrase for the BackgroundColor attribute than the standard:

=iif(rownumber (nothing) mod 2 = 0, "PaleGoldenRed", "White")

BackgroundColor attribute

We will use the SSRS functions Row Number and Modulo for alternate row coloring. Here, the row Number function returns the count of rows within the provided region as a continuous value. So, every row has a count inside one defined range. The scope can be shown in Row/Column Groups.

Modulo: Returns the residual of one number divided by another using the modulo function.

dividend % divisor (syntax)

The following is how that expression works:

When the report executes, the Row Number() function will return the actual row number. The scope, or whenever we want the row number to change to 1, is specified inside the brackets. We inform it that the scope is the full report using “Nothing,” so row numbers begin with one on the first row and continue counting up through the entire document. The Mod operator returns the residue of a division and stands for “modulo.” The residue of a division where the row number is split by two is returned in this example by the phrase.

The row number is odd if the remainder is one, even if the remaining is two. In VB.Net, the language used in the Expressions dialogue, 0 represents False, or any integer represents True. Therefore, when the row value is odd, the remainder is 1, or True, restoring the PaleGoldenRod color. When the row value is even, the remainder is 0, or False, resulting in the return of the LightSteelBlue color. Here is our sample report:

SSRS alternate row color

Alternate rows of the table are highlighted in a specified color in the output.

Example of SSRS Alternate Row Color

Let’s see how to implement alternate background colors in rows here. Let’s get started:

Step 1: The first step is to choose a corresponding data source and a query format. Click Data Set Properties and navigate through the steps.

SSRS Alternate Row Color Example 1

Step 2: In the Dataset given, we have used the following Custom SQL query:

We saw that we initially had a report name, and the background color was None or white.

SSRS Alternate Row Color Example 2

Step 3: Meanwhile, insert a Table here:

Then, in the SSRS report, build a table and connect it to the data set; we will get the following report.

SSRS Alternate Row Color Example 3

Then, right-click on the data field, insert all the necessary fields and click preview to view a table.

SSRS Alternate Row Color Example 3-2

Step 4:

Select BackgroundColor Property in the Properties box, then select the arrowhead button on the side. Then, as indicated in the screenshot below, click on expression. When we click on the BackgroundColor option, a color window appears, and we can see that the background color is configured to No Color, which implies the backdrop seems to have no color.

If needed the same color for all rows, one can choose any color from the color window; however, we would like to give the report an alternate row color, so click on the Expression box.

Example 4

Step 5:

The Expression is given as

=IIF(ROWNUMBER(NOTHING) MOD 2, "LIGHTGREY", "WHITE")

This expression specifies a different row background color; we can use any color we choose. Colors could also be represented using hexadecimal values. Color hexadecimal values can be found here. Then press the OK button. Take a look at the image below. 

Example 5

Step 6: Now that we’ve done all the required reforms, let’s look at the report. Each Tablix row does have a distinct backdrop color, as shown in the image below. The final report should look like this:

Example 6

Note:

Alternate Row Colors in SSRS Matrix Control: Matrix is a SQL Server Reporting Services function that allows users to create variable columns and rows. This implies that, unlike the last table example, columns will increase in the matrix control.

Conclusion

Finally, this article shows how to add Alternative Row Color to an SSRS Report. Also completed with an example of how to add Alternative Row Colors to an SSRS Report using Expressions. This notion makes the report more accessible for business customers and simplifies.

Recommended Articles

This is a guide to SSRS Alternate Row Color. Here we also discuss the definition and overview of SSRS Alternate Row Color and the example. You may also look at the following articles to learn more –

  1. What is SSRS?
  2. PyTorch Loss
  3. SSRS Interview Questions
  4. SSRS Versions
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more