Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS SWITCH Syntax not working

I have a columns in my dataset that will be returning several different values. In an attempt to to use grouping in the report I am trying to clean up the data. After reading several posts I found this post that seemed to be very close to what I needed.

I set up my expressions like this

=SWITCH(
Left(Fields!T6_TOW_BY.Value,3)="ACE","ACE WRECKER",
Left(Fields!T6_TOW_BY.Value,3)="CAR","CAR STORE",
Left(Fields!T6_TOW_BY.Value,7)="THE CAR","CAR STORE",
Fields!T6_TOW_BY.Value

)

The expression does not throw an error when I preview it, but all the columns show "error" Can anyone please show me where I am going wrong here?

Thanks

like image 924
Perry Avatar asked Mar 23 '26 21:03

Perry


1 Answers

The Switch statement requires pairs of arguments. You can't just have the last value by itself as an Else condition. Try this:

=SWITCH(
Left(Fields!T6_TOW_BY.Value,3)="ACE","ACE WRECKER",
Left(Fields!T6_TOW_BY.Value,3)="CAR","CAR STORE",
Left(Fields!T6_TOW_BY.Value,7)="THE CAR","CAR STORE",
True, Fields!T6_TOW_BY.Value
)
like image 103
StevenWhite Avatar answered Mar 26 '26 03:03

StevenWhite



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!