@CASE_INT

The CASE_INT function is used to return a single value from a variable list of multiple possible returns, with a comparison made between a switch and 1 or more case values, both of type integral number. The first parameter to the function is evaluated as an integral number. 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 an integer 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 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_INT (Integer To Match, Integer 1, Return 1 [, ..., Integer N, Return N] [, Otherwise])
Integer To Match
Required integral number parameter, contains the value upon which the function will switch, i.e. compare against each of the Integer N parameters in turn until a match is found.
Integer 1
Required integral number parameter, contains the value to which Integer To Match is compared. This parameter must be followed by the Return 1 parameter, which is the value returned when Integer To Match matches the Integer 1 value.
Return 1
Required parameter with a context-dependent data type, contains the value returned if Integer To Match matches Integer 1.
Otherwise / Integer 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 Integer To Match does not match any of the Integer N parameters. If this parameter is followed by another function parameter, it is evaluated as an integral number. In this situation it is evaluated by the function to determine if the value matches the Integer To Match parameter value. If it matches, the subsequent parameter is evaluated by the function. If not, the function evaluates the next parameter. Multiple Integer 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 Integer To Match matches the corresponding Integer N parameter.

Supported Return Types:

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