Alternate row colors in RDLC using flat dataset

一曲冷凌霜 提交于 2019-12-25 03:07:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!