I am trying to evaluate a text box value using SSSRS expression.
Currently I am doing something like following:
=IIF(Fields!VariableValue.Value =1,"Pass",IIF(Fields!VariableValue.Value = 2,"Fail",IIF(Fields!VariableValue.Value = 3,"Abort",IIF(Fields!VariableValue.Value = 4,"ByPass",IIF(Fields!VariableValue.Value ="#Error","NA",Fields!VariableValue.Value)))))
Is there a better way of doing this?
It's not perfect, but you can use SWITCH to make it a bit easier to read:
=Switch
(
Fields!VariableValue.Value = 1, "Pass",
Fields!VariableValue.Value = 2, "Fail",
Fields!VariableValue.Value = 3, "Abort",
Fields!VariableValue.Value = 4, "ByPass",
Fields!VariableValue.Value = "#Error", "NA"
true, Fields!VariableValue.Value
)
Looking at your example, I'm not 100% sure the original or the new expression will even work (is VariableValue
a number or text?) but hopefully this is better way for you.