问题
I am using a tablix in an rdlc report which uses a flat (Single row datasource), however the values which are displayed are in multiple rows. I need to add alternate row coloring for the same,I cannot use a RowNumber as I am working off a flat dataset. Are there any other approaches I can take ? TIA
回答1:
I'm not certain what you are referring to as a flat single row datasource appearing as multiple rows. I am assuming what you actually have is a regular table of values.
You can use a combination of CountDistinct
and RunningValue
to calculate a row number in the background that you can then use to set the BackgroundColor property of your rows.
For example the following expression in the BackgroundColor property of the tablix row
=iif((RunningValue(CountDistinct(Fields!Serial.Value), Sum, "DataSet1") mod 2) = 0, "Tomato", "LimeGreen")
Sets this table to have alternating red and green rows, without editing the datasource at all.
来源:https://stackoverflow.com/questions/32494750/alternate-row-colors-in-rdlc-using-flat-dataset