简体   繁体   中英

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. 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. 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

=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. 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

=Parameters!Year.Label = "currentYear"

This will return True when the parameter is currentYear and therefore hide the textbox.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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