简体   繁体   English

参数 label IF 语句的 SSRS 表达式

[英]SSRS expression for parameter label IF statement

In SSRS I want to do an expression which changes some text based on the parameter input, based of the label rather than the value.在 SSRS 中,我想做一个表达式,它根据参数输入更改一些文本,基于 label 而不是值。 I do not know the syntax to achieve this.我不知道实现此目的的语法。

My parameter is for selecting years:我的参数用于选择年份:

Label        | Value
----------------------
previousYear | 2019
currentYear  | 2020
nextYear     | 2021

I want to do something like:我想做类似的事情:

=IIF(Parameters!Year.Label = "nextYear" , "Fees - Next Year", "Need to hide")
IIF(Parameters!Year.Label = "previousYear" , "Fees - Previous Year, "Need to hide"

So for example, the label is previousYear, I want "Fees - Next Year" else, hide this text.因此,例如,label 是上一年,我想要“费用 - 下一年”,否则,隐藏此文本。 This will be achieved in a separate expression to set the visibility.这将在单独的表达式中实现以设置可见性。

Assuming you only have Previous, Current and Next Year then you could simplify it by doing假设您只有 Previous、Current 和 Next Year,那么您可以通过以下方式简化它

=IIF(Parameters!Year.Label = "currentYear", "")

This also assumes that your parameter is not a multi-value parameter and that you want to display nothing for currentYear.这还假设您的参数不是多值参数,并且您不想为 currentYear 显示任何内容。 The above expresssion will just display an empty string rather than hiding the textbox.上面的表达式将只显示一个空字符串而不是隐藏文本框。

If you want the textbox actually hidden, in addition to the above value exression, set the hidden property to如果您希望文本框实际隐藏,除了上面的值表达式之外,将hidden属性设置为

=Parameters!Year.Label = "currentYear"

This will return True when the parameter is currentYear and therefore hide the textbox.当参数为 currentYear 时,这将返回True并因此隐藏文本框。

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

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