Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Conditional Processing » ChooseByCase

ChooseByCase


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

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

Description of usage of this filter can be found in examples and tutorial: HMI Configuration Page.
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 Advanced Complexity Level.

Filter Group

This filter is member of Choose filter group.

See Also

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