14

I have the following expression within a report:

= Switch( Fields!RATE_CODE.Value = "First", " £/Week",
          Fields!RATE_CODE.Value = "Second", " £/Day")

I've searched all over but cannot find a way to add an else or default to this expression. There doesn't seem to be any doc's on this contruct either.

Is this possible?

m.edmondson
  • 30,382
  • 27
  • 123
  • 206

1 Answers1

29

The Switch function returns the value associated with the first expression in a series that evaluates to true, you can use the following trick:

= Switch( Fields!RATE_CODE.Value = "First" , " £/Week",
          Fields!RATE_CODE.Value = "Second", " £/Day",
          1 = 1                            , "default value" )
Arian
  • 12,793
  • 66
  • 176
  • 300
Marek Grzenkowicz
  • 17,024
  • 9
  • 81
  • 111