简体   繁体   English

SSRS行可见性表达式

[英]SSRS Row Visibility Expression

I have a report that has two date parameters (StartDate and StartInMarketDate). 我有一个包含两个日期参数(StartDate和StartInMarketDate)的报告。 In some cases, the StartInMarketDate value is the database can be NULL. 在某些情况下,StartInMarketDate值是数据库可以为NULL。 When either both parameters are NULL or the StartInMarketDate parameter is NULL, all records should appear on the report. 当两个参数都为NULL或StartInMarketDate参数为NULL时,所有记录应出现在报表上。 When a date is given for the StartInMarketDate parameter and the StartDate is NULL, the report should exclude all records where the StartInMarketDate is NULL. 当为StartInMarketDate参数指定日期且StartDate为NULL时,报表应排除StartInMarketDate为NULL的所有记录。

I assume I should be able to resolve this issue hiding rows based on an expression, but I cannot get the correct syntax. 我认为我应该能够解决此问题,并基于表达式隐藏行,但是我无法获得正确的语法。

Below is the syntax I came up with, but it includes all the records when I enter the StartInMarketDate parameter, and excludes the correct records when I use the StartDate parameter. 下面是我想出的语法,但是当我输入StartInMarketDate参数时,它包括所有记录,而当我使用StartDate参数时,它排除了正确的记录。

=IIF(IsNothing(Parameters!StartInMarketDate.Value), IIF(IsNothing(Fields!StartInMarketDate.Value), IIF(IsNothing(Parameters!StartDate.Value), False, True), False), False)

Any suggestions on where I'm going wrong is appreciated. 任何关于我要去哪里的建议都值得赞赏。

Thanks. 谢谢。

I think you have the Hidden expression backwards - the value should be TRUE when it should Hide the row, not Show it. 我认为您具有向后隐藏的表达式-当其应隐藏行而不是显示该行时,该值应为TRUE

Your expression seems a little too complicated. 您的表情似乎有点复杂。 According to your criteria, you only want to exclude rows: 根据您的条件,您只想排除行:

When a date is given for StartInMarketDate parameter and the StartDate is NULL ... exclude all records where the StartInMarketDate field is NULL. 当为StartInMarketDate参数指定日期且StartDate为NULL时,请排除StartInMarketDate字段为NULL的所有记录。

=IIF(NOT IsNothing(Parameters!StartInMarketDate.Value) AND IsNothing(Parameters!StartDate.Value) AND IsNothing(Fields!StartInMarketDate.Value), TRUE, FALSE)

Is there somewhere where you want to filter where the StartInMarketDate date field matches the StartInMarketDate parameter? 是否有地方要过滤StartInMarketDate日期字段与StartInMarketDate参数匹配的地方?

If you want to use an expression, remember that you are setting the Hidden property, not a visible property. 如果要使用表达式,请记住要设置“隐藏”属性,而不是可见属性。 If you look at the outer IIF you have basically said IF StartInMarketDate is NOT empty then set Hidden to False (showing them all). 如果您查看外部IIF,则基本上说IF StartInMarketDate不为空,然后将Hidden设置为False(全部显示)。

Basically True = Hide; 基本上是True = Hide; False = Show. False =显示。

You might just need to swap all your True/False around. 您可能只需要交换所有对/错。

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

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