隐藏详细信息组中的行,但将其包含在父组小计中

时间:2012-02-09 20:07:37

标签: sql-server reporting-services ssrs-2008

我正在修改销售报告,其中我需要能够隐藏细节中的某些行,但仍然将它们包含在组小计中。如果我在详细信息组上设置过滤器以根据适当的标准消除这些行,则它们不再包含在组小计中。如果我调整细节行的行可见性,我可以使用相同的标准隐藏它们,并且数字包含在小计中,但这会弄乱RowNumber()的计数,并且带状行看起来像一团糟。还有另一种巧妙的做法,我忽略了吗?

1 个答案:

答案 0 :(得分:0)

请参阅此SO post

由于BackgroundColor属性所需表达式的简单性,我更喜欢Catch22's。在处理分组时,它似乎比=IIF(RunningValue...方法更强大。

摘要

添加此代码:

Private bOddRow As Boolean
'*************************************************************************
' -- Display green-bar type color banding in detail rows
' -- Call from BackGroundColor property of all detail row textboxes
' -- Set Toggle True for first item, False for others.
'*************************************************************************
Function AlternateColor(ByVal OddColor As String, _
         ByVal EvenColor As String, ByVal Toggle As Boolean) As String
    If Toggle Then bOddRow = Not bOddRow
    If bOddRow Then
        Return OddColor
    Else
        Return EvenColor
    End If
End Function

然后将此表达式用于详细信息单元格上的BackgroundColor属性值:

=Code.AlternateColor("AliceBlue", "White", True)