Back to Adaptive Vision Studio website

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


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

Name Type Description
inObjectIfTrue <T> Object to be chosen if the condition is met
inObjectIfFalse <T> Object to be chosen if the condition is NOT met
inCondition Bool Determines which object is to 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.


E.g. to choose GREEN color to visualize correct objects or RED to visualize defective ones.


  • Also consider the ternary operator ?: in Formula Blocks.
  • Use this filter only with primitive types. Otherwise, to avoid excessive data creation and copying it may be better to use a Variant Step macrofilter.


Description of usage of this filter can be found in examples and tutorial: Cap (Easy), HMI Configuration Page, HMI Recorder, IO Serial Port Communicator, Waffles, Brick destroy (Game), Using HMI multipanel control.
inObjectIfTrue = "Mike"
inObjectIfFalse = "Bill"
inCondition = False
outObject = "Bill"


This filter can be replaced with the following formula:

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of Choose filter group.

See Also

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