Introduction
Like every other report has some or the other way to make it look beautiful, SQL Reporting also has some good features, but here I will be just showing how to make the color change for alternate rows.
Purpose
Generally, with detailed reports, if the look is made a little good, then everyone loves it.
Using the code
There is not much coding to be done, just a single line of code will solve this issue. Get the DataSet
name after you have configured the DataSet
.
When you use the table in your report, the table, by default, shows three rows, the header, detail and the footer. In this section, we will delete the footer row. Select the detailed row, right click, and select Properties.
In the Properties page, select the BackgroundColor
property, pull down the dropdown, and select <Expression>.
On the left pane of the Edit Expression, select Constants (which is selected by default), and in the Expression pane, type the following line and click OK:
=IIF(RowNumber("NWDataSet") Mod 2, "Gainsboro", "White")
// NWDataSet is the Dataset name.
That's it! Click the preview and you are good to go..
Points of Interest
SQL Reporting tool provides a lot of great other features, like if you have a detailed report of employees salary list and you want to highlight only rows whose salary is high, you could do it.