SelectIndex

The SelectIndex function outputs the index number of the first input stream that is True, otherwise it outputs inputN + 1.

Input

Number of Connections: Min: 1/Max:Infinite
InputData TypeDescription
InputNBooleanBoolean

Output

OutputData TypeDescription
Output1int The index number of the first input stream that is True.
For example, if the first input stream is True, "1" is output.
If no input streams are set to True, inputN + 1 is output.

How to use the SelectIndex function

When the SelectIndex function is used with functions that return a Boolean value and a Choice function, a selection structure similar to a programming language's else if can be created in the Mapper component's flow.

For example, the else if code below,

if (Field1 == Field2)
    return Field4;
else if (Field1 == Field3)
    return Field5;
else
    return Field6;

can be created by inputing the result of an Equal function with Field1 and Field2 as inputs, and the result of an Equal function with Field1 and Field3 as inputs into a SelectIndex function. And the resulting output from the SelectIndex function is then input into a Choice function as Input1, followed by Field2 as Input2, Field5 as Input3, and Field6 as input4.