Reporting Services Expression Using a Switch

I could not get this expression to work with report services. I have to use IF and ELSE IF. Thank you for any suggestions.

= Switch( IsNothing(Fields!field_date.Value),"", Fields!set_flag.Value=1,"Declined", Fields!field_name.Value) 

Here is what I am trying to do.

If(IsNothing(Fields!field_date.Value)) Then "";

ElseIf Fields!set_flag.Value=1 Then "Declined";

Else Fields!field_name.Value
+5
source share
2 answers

Does SSRS use a VB runtime library? In this case, the switch statement is documented here and states that you must even have a number . If this is your problem, you are likely to get a shot ArgumentException.

If you want to have a default return value, you need to add a dummy condition that always evaluates to true:

= Switch( IsNothing(Fields!field_date.Value),"", Fields!set_flag.Value=1,"Declined", True, Fields!field_name.Value) 
+7

, gbn. . Microsoft Reporting Services: http://msdn.microsoft.com/en-us/library/ms156028%28v=sql.100%29.aspx

, IIF . , -

=IIF(IsNothing(Fields!field_date.Value),"",IIF(Fields!set_flag.Value=1,"Declined",Fields!field_name.Value)

2 IIF - , , . , .

0

All Articles