|
These functions provide additional options to using control structures to achieve the same results.
Function | Description | Arguments |
---|---|---|
Choose (index, choice1, choice2, ..., choiceN) | Returns a value from the list of choices based on the value of index.For example, if index is 1, it returns choice1;if index is 2, it returns choice2; and so forth. | index is a Number or numeric expression that specifies the index of the choice. It should be between 1 and the number of available choices. If it is out of bounds, Choose returns a default value. (The default value returned depends on the type of the choices. For example, if the choices are of Number type, the default value is 0, and if the choices are of String type, the default value is the empty string ("").) choice is one of the options to choose from. All choices must be of the same type. A choice can be any simple type (Number, Currency, String, Boolean, Date, Time, or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range, or DateTime Range), but it may not be an array. |
IIF (expression, truePart, falsePart) | Returns one of two parts, depending on the evaluation of the expression. | expression is a Boolean expression. truePart is the value returned if expression is True. It can be any simple type (Number, Currency, String, Boolean, Date, Time, or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range, or DateTime Range), but it may not be an array. falsePart is the value returned if expression is False. It must be of the same type as truePart. |
Switch (expr1, value1, expr2, value2, ..., exprN, valueN) | The argument list for Switch consists of pairs of expressions and values. Switch evaluates the expressions from left to right and returns the value associated with the first expression to evaluate to True. | expr1, expr2, ..., exprN are Boolean expressions. value1, value2, ...., valueN are the possible values that may be returned. All the values must be of the same type. A value can be any simple type (Number, Currency, String, Boolean, Date, Time, or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range, or DateTime Range), but it may not be an array. |
|