Back to Aurora Vision Studio website

You are here: Start » Filter Reference » Data Flow » Conditional Processing » ChooseByPredicate

ChooseByPredicate


Module: FoundationLite

Returns one of the two input objects depending on the specified condition.

Applications

E.g. to choose GREEN color to visualize correct objects or RED to visualize defective ones.
Name Type Description
Input value inObjectIfTrue <T> Object to be chosen if the condition is met
Input value inObjectIfFalse <T> Object to be chosen if the condition is NOT met
Input value inCondition Bool Determines which object is to 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

Description of usage of this filter can be found in examples and tutorial: Cap (Easy), IO Serial Port Communicator.
inObjectIfTrue = "Mike"
inObjectIfFalse = "Bill"
inCondition = False
outObject = "Bill"

Remarks

This filter can be replaced with the following formula:

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.
  • ChooseByCase – Returns one of the input objects depending on the specified case index.