To alternate color of the lines in the table, you can use the function RowNumber() . To generate alternating colors for a table's Detail row, similar to those displayed in Table 13.7, you can set the BackgroundColor property of all columns and the table's Detail row to the expression =IIF((RowNumber("MyTable") Mod 2) = 0, "LightGrey", "White") . Table 13.7. Alternating Table Row Colors
What if alternating colors need to be set for the group header (or footer)? In this case, you can employ the RunningValue() function to return a row number of a group's header. If you have a table with a single group that uses =Fields!ProductId.Value as a group expression and you only display the group's header in the result, you can set the BackgroundColor property for all columns in the group's header equal to the expression =IIF(RunningValue(Fields!Name.Value, CountDistinct, Nothing) Mod 2=0,"Gainsboro", "White") to generate alternating colors, similar to Table 13.8. Table 13.8. Design of Alternating Colors for the Group Header
The resulting output is presented in Table 13.9. Note the number of items displayed in the Items Sold column. Although each group contains more than one hundred rowseach group's header is displayed only once, thus Items Sold displays aggregate number of rows in a group. Table 13.9. Presentation of Alternating Colors for the Group Header/Footer
Similarly to a single group, to display alternating colors when there is more than one table group, you can use RunningValue() on the combination of all group expressions, like this: [View full width]
Note The Demo Alternating Colors.rdl sample illustrates concepts discussed in this section. |