简体   繁体   English

在SSRS表达式中使用IIF和AND

[英]Using IIF and AND in SSRS Expression

I have a table like below 我有一个像下面的桌子

在此处输入图片说明

I want to hide the rows where ALL 3 columns are 0. All the columns are of INT data type 我想隐藏所有3列均为0的行。所有列均为INT数据类型

My expression is like so: 我的表情是这样的:

    =IIF((Fields!PastVal.Value=0) AND (Fields!DatePay=0) AND (Fields!Line.Value=0),False,True)

But no data is returned except the column label(heading). 但是除了列标签(标题)之外,没有其他数据返回。 What could be wrong with my express? 我的快递有什么问题吗?

Create a filter on the tablix, where you simply add 3 conditions, one for each of the 3 fields: 在tablix上创建一个过滤器,您只需在其中添加3个条件,就可以为3个字段分别添加一个:

在此处输入图片说明

Use the <> as operator on each condition, and simply specify 0 as the Value rather than using an expression. 在每个条件上使用<>作为运算符,只需将0指定为Value即可,而不使用表达式。

Are you using Row Visibility? 您是否正在使用行可见性? The True or False is for Hiding the Row yet you set it to false if they equal 0. TrueFalse用于隐藏行,但如果它们等于0,则将其设置为false。

=IIF((Fields!PastVal.Value=0) AND (Fields!DatePay=0) AND (Fields!Line.Value=0), True, False)

That still doesn't fix the issue though - some columns should have been displayed since you have data in your example. 但这仍然不能解决问题-由于示例中有数据,因此应该已经显示了一些列。

Are your data rows using SUM? 您的数据行是否使用SUM? If so, your expression would need to SUM also. 如果是这样,您的表达式也需要求和。

=IIF(SUM(Fields!PastVal.Value) = 0 AND SUM(Fields!DatePay.Value) = 0 AND SUM(Fields!Line.Value) = 0, True, False)

Thanks everyone for your kind suggestion. 谢谢大家的建议。 My expression was right all the while, but because I had a grouping on my report, I had to to set the Visibility through the Group Properties by clicking on Details. 我的表达一直很正确,但是由于我对报表进行了分组,因此我必须通过单击“详细信息”通过“组属性”来设置“可见性”。 Prior to that, I was applying the filter by right clicking the detail row in the report body but that did not work. 在此之前,我通过在报表正文中的明细行上单击鼠标右键来应用过滤器,但这没有用。

Thanks everyone for your contribution. 感谢大家的贡献。 My fault. 我的错。 My report had a group level and because I was applying the filter by right clicking on my tablix, that did not work. 我的报告具有组级别,并且因为我通过右键单击tablix来应用过滤器,所以无法正常工作。 I had to do it by right clicking on Detail in the Row Group. 我必须通过右键单击“行组”中的“详细信息”来执行此操作。

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

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