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.