简体   繁体   English

SSRS在组内交替行颜色

[英]SSRS Alternating Row Colour Within Groups

I have a ssrs table report with row grouping and I would like to know how to change the colours of rows in groups without changing the background colour of the group column itself. 我有一个带有行分组的ssrs表报告,我想知道如何在不更改组列本身的背景色的情况下更改组中行的颜色。 With the answers I have found and implemented I get the effect of the second table in the picture when I want the effect of the first table: 有了我找到并实现的答案,当我想要第一个表的效果时,就得到了图片中第二个表的效果:

在此处输入图片说明

Any help will be much appreciated. 任何帮助都感激不尽。

This is a picture of the actual report and it's grouping: 这是实际报告的图片,并且进行了分组:

在此处输入图片说明

The RowNumber technique only works on the Details group ie the lowest level group (with no Group columns defined). 行号技术仅适用于“详细信息”组,即最低级别的组(未定义“组”列)。 Think of it as returning the Row in the Dataset. 可以将其视为返回数据集中的行。

Instead I would write an expression that calculates the equivalent to RowNumber, but for the Group level - typically something using RunningValue ... CountDistinct on the Group Key field, like this: 相反,我会写一个表达式来计算与RowNumber等效的表达式,但是对于Group级别-通常在Group Key字段上使用RunningValue ... CountDistinct进行RunningValue ... CountDistinct ,如下所示:

= Iif ( RunningValue ( Fields!tableid.Value , CountDistinct , "TheNameOfYourGroup") Mod 2 = 0, "White", "WhiteSmoke")

I need to apply the alternation to all rows including Total rows so: 我需要将交替应用于所有行,包括总计行,因此:

 'define Report Variables: ActiveRowColour, ColourA, ColourB 'Call this function in one cell per row by setting => BackgroundColor=Code.NewActiveRowColour(Variables!ActiveRowColour.Value) 'Then All other cells on that row set -> BackgroundColor=Variables!ActiveRowColour.Value Public Function NewActiveRowColour(ByVal sActiveRowColour As String) As String If sActiveRowColour = Report.Variables!ColourA.Value Then Report.Variables!ActiveRowColour.Value = Report.Variables!ColourB.Value Return Report.Variables!ColourB.Value Else Report.Variables!ActiveRowColour.Value = Report.Variables!ColourA.Value Return Report.Variables!ColourA.Value End If End Function 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM