RDLC Switch Construct - is there an Else?
Asked Answered
I

1

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?

Inequality answered 21/6, 2012 at 9:56 Comment(0)
P
30

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" )
Plus answered 21/6, 2012 at 10:1 Comment(1)
Thanks - I'd literally discovered the same myself except I was using ""="". You deserve the credit though.Inequality

© 2022 - 2024 — McMap. All rights reserved.