banner



Can We Use Background Color For Parameter In Ssrs Tool

Setting alternating row colors in SSRS (SQL Server Reporting Services) is an of import visualization configuration for end-users and then that they can easily view their reports. All the same, setting alternating colors in SSRS is non a click of a push button configuration like in the Microsoft Excel.

The post-obit screenshot shows the output in Microsoft Excel when the Alternating row color is ready for a table.

How alternate Row colors are set in Microsoft Excel.

However, in SSRS this is non straight forward equally in Microsoft Excel shown in the above screenshot.

Allow united states configure a report in SSRS.

SSRS Sample Written report

Post-obit is the SSRS project solution.

SSRS Project Solution to demostrate alternate row colors.

First, the data source is created for the AdventureWorks sample database in any SQL Server instance. After the data source creation, the next footstep is to create a information set with the following t-SQL lawmaking.

Delight note that only six orders are used for demonstration purposes. Likewise, the information set is sorted past the order past OrderID for the sit-in purposes.

Next is to create a tabular array in the SSRS report and link with the data set and you volition run across the post-obit report.

Defaut SSRS report

No major formatting was done to the report except for the rounding the Line full to the ii decimal points.

Alternating Row Colors in SSRS for Table

The next chore is to prepare alternating row colors in SSRS in the to a higher place SSRS Report.

Right-click the data row as shown in the below screenshot, click F4 or properties window in the View menu.

Configuring alternate row colors in SSRS Report.

When selecting this, you volition run into the BackgroundColor option. By default, information technology is No Colour, which ways that there is no color for the background and use tin can select any colors. However, those options volition provide a written report with the aforementioned colors for all rows, non for alternate row colors in SSRS Study as required.

You tin select the Expression… option in the listed options which will give you a screen when yous can enter an expression.

Expression for the alternate row colors in SSRS.

In the expression, ROWNUMBER function is used. ROWNUMBER will be the row number for the row. The method used in this case is that the odd row numbers are lite blue while the fifty-fifty row numbers are blue. Odd rows are establish by for the rows which has reminder 1 when the row number is divided by 2 and similarly, the even rows are the rows which will be the reminder 0 when the row number is divided past 2. This unabridged logic is used with the IIF and ROWNUMBER functions as shown in the to a higher place screenshot.

Then the SSRS report is shown as following which has alternate row colors.

Final output of alternate row colors in SSRS

Now this will be same as what you get in Microsoft Excel.

Alternate Row Colors in SSRS When Grouping

In SSRS, typically y'all add groups to the detail records. For example, in the above study, the Sales Guild ID is repeated in the in a higher place data set. This means that the study can exist grouped by the Sales Order ID and when the grouping is washed, the written report volition exist looked like the following screenshot.

Invalid alternate row color in SSRS when the grouping is done for the tablix report.

You lot volition observe that groundwork color has gone wrong for the grouping rows. This is because an boosted row is introduced to the group column. To avoid this, the background color of the grouping row should be modified accordingly.

Modify back ground for color in the grouped report.

Then the report will look like the following screenshot.

Alternate row colors in SSRS for the grouping in SSRS reports.

Alternating Row Colors in SSRS Matrix Command

Matrix is an SSRS control from which yous can have dynamic columns and rows. This means that unlike in the previous example of tables, in the matrix control, columns will grow.

In the following report, order numbers are in the columns while the production names are in the rows. In instance you get a new order number that volition appear in the side by side column.

Sample Matrix report is SSRS.

Due to this dynamic nature of the report, the previous unproblematic dominion volition not work for matrix. If you apply the same rule, the alternate color will occur not at the row level but for every value in the matrix.

This means we need a new approach for the reports with matrix control.

  1. Add a column outside the dynamic columns which are shown in the following screenshot and highlighted column is the newly added cavalcade

    Add a column outside the dynamic columns

  2. Then add together an expression to the newly added cavalcade as shown in the below screenshot. This column is Textbox10

    Adding a value to the newly added column.

    Expression is : =IIF(RUNNINGVALUE (Fields!ProductName.Value,CountDistinct,Nothing) Mod 2, "LightBlue", "Blue")

    It is similar to the previous expression, just only thing is, RUNNINGVALUE for the grouped column which is the Product Proper name is used.

    Now you lot volition get the color into the text value as shown in the below screenshot:

    Color will be displayed in in the newly added column in the SSRS matrix report.

  3. Next step is to get the groundwork color from the value of the newly added column. Since the colour is available the newly added cavalcade, that color can exist set to the background of the matrix row

    Seeting up value of the nwely column to the background color of the row.

  4. Next is to hibernate the newly added column since this column is used only as an internal column to the study. This can exist done by setting the Hidden option to Truthful

    Hide the newly added column

Finally, the study volition look like the post-obit screenshot.

Final output for alternate row colors in SSRS Matrix control.

In both the modes, a new the column is added, and information technology will automatically become the necessary background color so that it does not need any additional configurations. Besides, instead of the proper noun of the colour, you can utilize the color code which can exist taken from the RGB Color Codes Nautical chart

  • Author
  • Contempo Posts

Dinesh Asanka

Can We Use Background Color For Parameter In Ssrs Tool,

Source: https://www.sqlshack.com/alternate-row-colors-in-ssrs/

Posted by: harmonhareand.blogspot.com

0 Response to "Can We Use Background Color For Parameter In Ssrs Tool"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel