In Crystal Reports it is quite easy to define alternating row colors.
- You just go to the Section Expert.
- Click Details.
- Choose Color.
- Click the formula button x+2.
- There you fill in a formula like this:
if recordnumber mod 2 = 0 then
When you want to alternate group colors, in stead of clicking Details, you click a Group header or footer. The formula is just slightly different:
if groupnumber mod 2 = 0 then
SS Reporting Service / Report Builder
In SSRS or Report Builder we can do the same but is just a little bit more complicated. First take a look at row coloring.
- Select a cell in a row.
- Right click.
- Select Text Box Properties.
- Select Fill.
- Click fx behind Fill color.
- Type the Formula.
We can also do this by selecting the entire row and using the properties to change the fill color.
=IIF(RunningValue(Fields!Category.Value,COUNTDISTINCT,"NameGroup") MOD 2 = 0,"PaleGreen","White")
And once more, we have to repeat this for each cell in the group row.