隐藏的动态矩阵组仍然占用SSRS 2005中的空间

时间:2010-10-13 01:29:06

标签: sql-server-2005 sql-server-2008 reporting-services formatting matrix

问题

我正在使用来自Dynamic GroupingChris Hays's Reporting Services Sleazy Hacks Weblog中的动态矩阵组(顺便说一下,它有一些很棒的东西,值得一试)。我的行和列组绑定到两个多值参数,一切都很好,除了一件事。即使我禁止显示未使用的组,他们仍然占用空间。

以下是当我只选择一个行组和一个列组时报告的样子:

What the matrix looks like now, with extra space 请注意,即使不受欢迎的组具有隐藏True属性(由表达式设置),它们仍会占用空间。这就是我希望它看起来像(我手工切割图片中的空白区域):

How I'd like the matrix to look

问题

当隐藏相应的矩阵组时,有没有人有任何想法如何使空白区域缩小?

只是为了好奇(不是问题的一部分)

作为参考,以下是布局模式中矩阵的样子:

Layout view of the matrix

如果其他人想要做这样的动态矩阵组,这里的代码部分可以解决这个问题:

Public Function ValueIsInMultiParameter(MultiParameter As Parameter, Value As String) As Boolean
   Dim i as Long
   For i = 0 to MultiParameter.Count - 1
      If MultiParameter.Value(i) = Value Then Return True
   Next
   Return False
End Function

Public Function DynamicFieldValue(CurrentFields As Fields, MultiParameter As Parameter, Index As Long) As Object
   If ParameterCount(MultiParameter) - 1 < Index Then Return ""
   Return CurrentFields(MultiParameter.Value(Index)).Value
End Function

Public Function DynamicFieldFormattedValue(CurrentFields As Fields, MultiParameter As Parameter, Index As Long) As Object
   If ParameterCount(MultiParameter) - 1 < Index Then Return ""
   Return CustomFormat(CurrentFields(MultiParameter.Value(Index)).Value, MultiParameter.Value(Index))
End Function

Public Function DynamicGrouping(MultiParameter As Parameter, Index As Long) As Object
   If ParameterCount(MultiParameter) - 1 < Index Then Return "None"
   Return MultiParameter.Value(Index)
End Function

Public Function DynamicGroupingLabel(CurrentFields As Fields, MultiParameter As Parameter, Index As Long) As String
   If Index = 0 Then Return "Grand Total"
   If ParameterCount(MultiParameter) - 1 < Index Then Return ""
   Return CustomFormat(CurrentFields(MultiParameter.Value(Index - 1)).Value, MultiParameter.Value(Index - 1)) & " Total"
End Function

Public Function CustomFormat(Value As Object, ValueType As String) As String
   Select Case ValueType
      Case "DayOf"
         Return Format(Value, "M/d/yyyy")
      Case "WeekOf"
         Return Format(Value, "M/d/yyyy")
      Case "WeekDayPart"
         Return WeekdayName(Value)
      Case "MonthOf"
         Return Format(Value, "MMM yyyy")
      Case "MonthDayPart"
         Return "Day " & Value
      Case "MonthWeekPart"
         Return "Week " & Value
      Case "YearOf"
          Return Format(Value, "yyyy")
      Case "YearDayPart"
          Return "Day " & Value
      Case "YearWeekPart"
          Return "Week " & Value
      Case "YearMonthPart"
          Return MonthName(Value)
      Case "YearPart"
         Return Value
      Case Else
         Return Value
   End Select
End Function

Public Function ParameterCount(MultiParameter As Parameter) As Long
   If MultiParameter.Count = 0 OrElse MultiParameter.Value(0) = "1" Then Return 0
   Return MultiParameter.Count
End Function

在参数中,我放置了一个硬编码的可选分组选项列表,例如RowGroups参数有可用的值:

Label   Value
-----   -------
Year    YearOf
Month   MonthOf
Week    WeekOf
Day     DayOf

其中Value是DataSet返回的SQL列的名称。

1 个答案:

答案 0 :(得分:0)

我没有找到任何方法,但通过有条件地将较低分组项目的颜色设置为与未选择较低组的较高分组项目的颜色相同,您可以给出印象一个超宽的高分组项目,而不是空白旁边的正常大小的项目。

顺便说一句,自2006年以来,链接的博客似乎没有更新。