Description
Emulates the MS Access SWITCH function.
Evaluates a list of (up to 20) expressions and returns the value associated with the first expression in the list that is True.
If no expressions evaluate as true, the function returns null.
Syntax
SWITCH(<XPN1>, <ValueIfXPN1True>, [XPN2], [ValueIfXPN2True], ... [XPN20], [ValueIfXPN20True])
Arguments
Argument | Type | Description | Optional |
---|---|---|---|
XPN1 | Yes/No | Value to evaluate as true/false | No |
ValueIfXPN1True | Any | Value to return if XPN1 is true | No |
XPN2 | Yes/No | Value to evaluate as true/false | Yes |
ValueIfXPN2True | Any | Value to return if XPN2 is true | Yes – if XPN2 not set |
… | |||
XPN20 | Yes/No | Value to evaluate as true/false | Yes |
ValueIfXPN20True | Any | Value to return if XPN20 is true | Yes – if XPN20 not set |
Returns
Any
Examples
Expression: |
|
Returns: | When Source.Age = 30: “26 – 35” |