Start » Filter Reference » Data Flow » Conditional Processing » ChooseByCase

ChooseByCase


Module: FoundationLite

Returns one of the input objects depending on the specified case index.

Name Type Range Description
Input value
inObjectIfCase0 <T> Object to be chosen for the case 0
Input value
inObjectIfCase1 <T> Object to be chosen for the case 1
Input value
inObjectIfCase2 <T> Object to be chosen for the case 2
Input value
inObjectIfCase3 <T> Object to be chosen for the case 3
Input value
inObjectIfCase4 <T> Object to be chosen for the case 4
Input value
inObjectIfCase5 <T> Object to be chosen for the case 5
Input value
inObjectIfCase6 <T> Object to be chosen for the case 6
Input value
inObjectIfCase7 <T> Object to be chosen for the case 7
Input value
inCaseIndex Integer 0 - 7 Determines which object will be chosen
Output value
outObject <T> Chosen object

The type of this filter is defined using the type variable T which represents any valid type. Read more.

Hints

  • Also consider the ternary operator ?: in Formula Blocks.
  • This filter creates a full copy of one of the input objects. Thus, if you need the highest possible speed, use this filter only with primitive types. An alternative is to use Variant Step macrofilters which are fast and elegant.

Examples

inObjectIfCase0 = "Alice"
inObjectIfCase1 = "Bob"
inObjectIfCase2 = "Mike"
inObjectIfCase3 = "Katherine"
inObjectIfCase4 = "John"
inObjectIfCase5 = "Thomas"
inObjectIfCase6 = "Patricia"
inObjectIfCase7 = "Frank"
inCaseIndex = 2
outObject = "Mike"

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Case index out of range in ChooseByCase.

Complexity Level

This filter is available on Expert Complexity Level.

Filter Group

This filter is member of Choose filter group.

See Also

  • ChooseByRange – Returns one of the three input objects depending on whether the associated input value falls below, in or above the specified range.
  • ChooseByPredicate – Returns one of the two input objects depending on the specified condition.