简体   繁体   English

在SSRS表中隐藏一行

[英]Hide a row in SSRS table

I have a table in my report, that is calculating data from my dataset. 我的报表中有一个表格,该表格正在从数据集中计算数据。 I want to hide the rows that calculate results of 0. Here is a screen of my table. 我想隐藏计算结果为0的行。这是表格的屏幕。

在此处输入图片说明

For the count column, the formula is: 对于count列,公式为:

=Count(Fields!Age.Value > 90) And Count(Fields!Age.Value < 99)

I have tried various expressions both on the cell's property box (visibility expression), as well as the row's visibility. 我已经在单元格的属性框(可见性表达式)以及行的可见性上尝试了各种表达式。 My issue I think is that I don't know how to reference the row/cell with the values. 我认为我的问题是我不知道如何用值引用行/单元格。

I can't see the linked image (I'm assuming due to firewall rules on my end), but based on the description the below formula should work: 我看不到链接的图像(我想这是由于我的防火墙规则所致),但是根据描述,以下公式应该起作用:

=Iif(Fields!Age.Value > 90 And Fields!Age.Value < 99, True, False)

Place that in the Visibility section of the detail row group , rather than attached to an individual textbox. 将其放置在详细信息行组的“可见性”部分中,而不是附加到单个文本框。 It will hide the entire row if the age in that detail row meets the criteria. 如果该明细行中的年龄符合条件,它将隐藏整行。 (The Visibility expression sets the Hidden property, which is True for Hidden and False for Not Hidden). (可见性表达式设置了Hidden属性,对于Hidden为True,对于Not Hidden为False)。

If you're wanting to do this at a higher scope, such as by age bracket, then the formula becomes simpler (and is applied at that group rather than the detail group): 如果您想在更大的范围内(例如按年龄段)执行此操作,则公式会变得更简单(并应用于该组而不是详细信息组):

=Iif(Count(Fields!Age.Value) = 0, True, False)

This is because the group expression itself will take care of filtering the dataset for you, so you can simply see if the group contains any members rather than worrying about what values those members may contain. 这是因为组表达式本身将为您过滤数据集,因此您可以简单地查看组是否包含任何成员,而不必担心这些成员可能包含哪些值。

If you're not grouping by an age-value-related metric, then it becomes more complex: 如果您按与年龄值相关的指标进行分组,那么它将变得更加复杂:

=Iif(Sum(Iif(Fields!Age.Value > 90 And Fields!Age.Value < 99, 1, 0)) = 0,True, False)

The Count() function does not evaluate each member item; Count()函数不会评估每个成员项; it simply checks whether it exists. 它只是检查它是否存在。 The Sum() function does evaluate each member item, so you can use an Iif() expression to supply the Sum with a 1 or 0 depending on your criteria, and use the result of the Sum to see how many items in the overall set match your filters. Sum()函数评估每个成员项,因此您可以根据自己的条件使用Iif()表达式为Sum提供1或0,并使用Sum的结果查看整个集合中有多少项匹配您的过滤器。

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

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