SSRS expression switch/Else if

651    Asked by IraJoshi in Python , Asked on May 17, 2021

I have been messing around with this all morning and i just can't quite figure it out. A Parameter is with me that can be one of two values. Either I or P.

So i want the title on the report to say one thing when I is chosen, one thing when P is chosen, and one thing when both are chosen (this is a multi select parameter)

I am currently having this but it keeps coming up with #Error.

=Switch(Parameters!clmType.Value = "P","List of Professional Paper Claims ", Parameters!clmType.Value = "I","List of Institutional Paper Claims ", Parameters!clmType.Count > 1 ,"List of Professional & Institutional Paper Claims ")

I've also tried this

=Switch(Parameters!clmType.Value = "P","List of Professional Paper Claims ", Parameters!clmType.Value = "I","List of Institutional Paper Claims ", Parameters!clmType.Value = "P" and Parameters!clmType.Value = "I" ,"List of Professional & Institutional Paper Claims ")

Also used a nested IIF. But i am not sure that what would it look like, or the order of it.

I also have tried using this as a Nested IIF and still getting a #Error

=IIF(Parameters!clmType.Count > 1,"List of Professional & Institutional Paper Claims ", IIF(Parameters!clmType.Value = "P","List of Professional Paper Claims ","List of Institutional Paper Claims "))

So i know that it partially works because i have used this and it worked as expected

=IIF(Parameters!clmType.Count > 1,"List of Professional & Institutional Paper Claims ", "only one picked")
Answered by Jiten Miglani

To resolve ssrs switch:

  Syntax for case statement in SSRS:

Switch(Expression as Object)

Syntax for IIF() statement in SSRS:

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
Try to implement this variation of your first expression:
=Switch(Parameters!clmType.Value = "P","List of Professional Paper Claims ", Parameters!clmType.Value = "I","List of Institutional Paper Claims ", True,"List of Professional & Institutional Paper Claims ")

Your Answer

Interviews

Parent Categories