dinsdag 24 september 2013

Crystal Reports vs. SS RS / Report Builder: alternating row/group colors

Crystal Reports
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. 
=IIf(RowNumber(Nothing) Mod 2=0, "Silver", "Transparent")
  •  Repeat this for every cell in the row.
We can also do this by selecting the entire row and using the properties to change the fill color.

For Group rows we again have to select a cell. This time the formula is a lot more complicated. It would have to look like this:

=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.

Geen opmerkingen: