Reporting Services - 有条件隐藏矩阵列
在矩阵报告中,是否可以根据父组的值隐藏列? 例如,我有一个名为“值”的列,当包含该列的列组具有特定值时,我想隐藏该列。
In a matrix report is it possible to hide a column based on value of the parent group?
For example, I've got a column called "value" which I'd like to hide when the column group that contains it has a specific value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对的,这是可能的。 如果您单击该组并在“可见性”选项卡下编辑其属性,则可以使用表达式来显示可见性。 例如,我有一个包含详细信息组和值类型组的报告,我只想显示其中包含数据的值组。
我通过将组的可见性表达式设置为以下内容来实现此目的:
=CountDistinct(Fields!ValueType.Value,"matrix1_Detail")=1 OR Max(Abs(code.GetValue(Fields!Value)))=0
当表达式代码计算结果为 true,该列被隐藏。
Yes it is possible. It you click on the group and edit its properties under the Visibility tab you can the visibility using an expression. For example I have a report that has a detail group and a valuetype group and I would like to only show value groups that have data in them.
I do that by setting the visibility expression for the group to the following:
=CountDistinct(Fields!ValueType.Value,"matrix1_Detail")=1 OR Max(Abs(code.GetValue(Fields!Value)))=0
When the expression code evaluates to true the column is hidden.
是的,这是可能的。 它将涉及为数据单元格的可见性属性编写表达式。 表达式应包含 InScope() 函数以确保隐藏右侧列。 该表达式还将引用 ReportItems!textboxofcolumn.value (查找您要查找的特定值)。
转到 此处了解有关 InScope() 函数的更多信息
如果您需要表达式方面的帮助,请告诉我。
Yes this is possible. It would involve writing an expression for the Visibility property for the data cell. The expression should include the InScope() function to ensure that the right column is being hidden. The expression would also reference ReportItems!textboxofcolumn.value (looking for that specific value you're after).
Go here for more on the InScope() function
Let me know if you need a hand with the expression.
如果您只设置单元格或列的可见性(使用“隐藏”属性),它将在那里留下空白。 就像第一个回复所说,如果您创建一个列组,并设置该组的可见性,它就可以工作。
我将报告分成几个专栏组,每个组都针对同一件事。 设置中间组的可见性方程。 像冠军一样工作。
If you only set cell or column visibility (using the "hidden" property), it will leave white space there. Like the first reply said, if you create a column group, and set visibility on the group, it works.
I broke my report up into several column groups, each grouped on the same thing. Set the visibility equation on the middle group. Worked like a champ.
我认为您需要从 SQL 中的数据集中删除行或在 RS 中过滤掉它们。
I think you'll need to remove the rows from the dataset in SQL or filter them out in RS.
我需要一些东西来从导出的 Excel 工作表中排除空白列。 对我有用的是通过右键单击设计器中的顶部框,选择“根据表达式显示或隐藏”并使用如下表达式来选择矩阵中的整个列:
IsNothing(Max(Fields!COLUMNNAME.Value, “数据集”))
该列不会显示在报告中,也不会在导出中留下空白。 不需要列组或 InScope() 函数,但我使用的是一个非常基本的矩阵,只有一个行组。
I needed something to exclude blank columns from exported Excel sheets. What worked for me was select the entire column in the matrix by right-clicking on the top box in the designer, selecting "Show or hide based on an expression" and using an expression like:
IsNothing(Max(Fields!COLUMNNAME.Value, "DATASET"))
The column does not show on the report nor does it leave blanks in the export. No need of column groups or InScope() function, but I am using a very basic matrix that only has a single row group.