@CASE_STRING

The CASE_STRING function is used to return a single value from a variable list of multiple possible returns, with a comparison made between a switch and one or more case values, each of type string. The first parameter to the function is evaluated as a string. The last parameter to the function is the default return value and is optional. Parameters between the first and last are provided in pairs. The first parameter in a pair is the value to which the switch value is compared. If these two values are equal, the second value of the pair is returned by the function. The comparison between the switch value and the first parameter of a pair is performed as a case-sensitive string comparison. The data type for the second parameter in each pair is dependent on the context in which the function is called. If none of the case parameters match the switch parameter, and a default, non-paired parameter is provided, that parameter is evaluated and returned by the function. If no default parameter is provided, the default null equivalent of the context’s data type is returned, e.g. 0, False, null string, etc.

Parameters

@CASE_STRING (String To Match, String 1, Return 1 [, ..., String N, Return N,] [, Otherwise])
String To Match
Required string parameter, contains the value upon which the function will switch, i.e. compare against each of the String N parameters in turn until a match is found.
String 1
Required string parameter, contains the value to which String To Match is compared. This parameter must be followed by the Return 1 parameter, which is the value returned when String To Match matches the String 1 value.
Return 1
Required parameter with a context-dependent data type, contains the value returned if String To Match matches String 1.
Otherwise / String N
Optional parameter(s), the data type in which it is evaluated is dependent on whether it is the last parameter to the function, or if it is followed by another parameter. When this is the last parameter to the function, it will be evaluated in the data type corresponding to the context of the function call. In this situation, the parameter is the default Otherwise parameter, evaluated by the function when String To Match does not match any of the String N parameters. If this parameter is followed by another function parameter, it is evaluated as a string. In this situation, it is evaluated by the function to determine if the value matches the String To Match parameter value. If it matches, the subsequent parameter is evaluated by the function. If not, the function evaluates the next parameter. Multiple String N parameters can be provided with the requirement that they are paired with corresponding Return N parameters. Only one Otherwise parameter may be provided.
Return N
Optional parameter(s) with a context-dependent data type, contains the value returned if String To Match matches the corresponding String N parameter.

Supported Return Types:

  • Boolean
  • Integral Number
  • Decimal Number
  • String
  • Property