Example – the green-bar-matrix
When we applied alternating colors in the Tablix using decision functions, I mentioned that in a matrix, which is a Tablix with row and column groups, the function has an undesired result.
Note
For this demonstration you can import the object: Packt - CH03-5. In fact, this report continues from where we left off in the object: Packt - CH02-7.
Select the textbox under the location code in the layout of the report and, in the BackgroundColor property, set the following expression:
Now run the report and you will see the following output:
As you can see, the effect is not alternating green bars but it is more like a strange checker-board. The reason for this is that the RowNumber
property for this textbox at runtime is not continuous because it depends on the row and column groups. In order to create a green-bar effect, you need to use another expression.
Start by adding the following to the code section of the report:
Private bOddRow As Boolean Function AlternateColor...