SWITCHVAL

Usage

TIBCO iProcess Workspace (Browser)

TIBCO iProcess Workspace (Windows)

Evaluates a conditional argument that returns a numeric type result based on a range of arguments.

Syntax

SWITCHVAL (numexpression, defaultvalue, case1val, case2val [case3val, case4val ...])

where:

numexpression (real) is an expression to evaluate that returns a positive numeric integer value of 1 to n.
defaultvalue (vartype) is the result to return if the result of the evaluating numexpression is neither a positive integer nor a value between 1 to n, where n is the number of case arguments provided in the expression.
case1val (vartype) is a case argument whose result is returned if the numexpression is a value between 1 to n, where n is the number of case arguments provided in the expression.
case2val (vartype) is a case argument whose result is returned if the numexpression is a value between 2 to n, where n is the number of case arguments provided in the expression.
case3val (vartype) is a case argument whose result is returned if the numexpression is a value between 3 to n, where n is the number of case arguments provided in the expression.
case4val (vartype) is a case argument whose result is returned if the numexpression is a value between 4 to n, where n is the number of case arguments provided in the expression.
Note: At least four arguments must be provided. Additional arguments are optional.

Returns

The resulting data from the evaluation of the numexpression and defaultexpression.

Examples

TIBCO iProcess Modeler:

This example converts a number to a name from a list of names:

strfield := SWITCHVAL (numfield, "Out Of Range", "John", "Richard", "Michael", "Mark", "Steven", "Paul")

If the value of numfield is 1, the function returns the value John. If the value of numfield is 4, the function returns the value Mark. If the value is < 1 or > 6 then the function returns Out Of Range.

TIBCO Business Studio

strfield = IPEGeneralUtil.SWITCHVAL (numfield, "Out Of Range", "John", "Richard", "Michael", "Mark", "Steven", "Paul");