Back to Aurora Vision Studio website

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

ChooseByRange


Module: FoundationLite

Returns one of the three input objects depending on whether the associated input value falls below, in or above the specified range.

Applications

E.g. to choose GREEN, YELLOW or RED color for visualization on the basis of three ranges of some value: OK, WARNING, NOK.
Name Type Description
Input value inObjectIfLower <T> Object to be chosen when the value is below the range
Input value inObjectIfInRange <T> Object to be chosen when the value is in the range
Input value inObjectIfHigher <T> Object to be chosen when the value is above the range
Input value inValue Real Value which is compared against the range
Input value inMinimum Real* Lower end of the range
Input value inMaximum Real* Upper end of the range
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.

Description

The filter accepts three objects of the T type (decided on filter creation), and passes exactly one of them onto outObject output. The object to pass is selected depending on whether the inValue fits the (inMin, inMax) range.

  • If inValue is smaller than inMin, inObjectIfLower is selected.
  • If inValue fits closed range (inMin, inMax), inObjectIfInRange is selected.
  • If inValue is larger than inMax, inObjectIfHigher is selected.

In the special case of inMin being greater than inMax, first matching condition is applied, which means that if inValue is higher than inMax and lower than inMin, inObjectIfLower is selected.

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

inObjectIfLower = "Mike"
inObjectIfInRange = "Bill"
inObjectIfHigher = "Alice"
inValue = 10.0
inMin = 0.0
inMax = 10.0
outObject = "Bill"
inObjectIfLower = "Mike"
inObjectIfInRange = "Bill"
inObjectIfHigher = "Alice"
inValue = 10.1
inMin = 0.0
inMax = 10.0
outObject = "Alice"

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 Incorrect (NaN) float value on inValue input in ChooseByRange.

Complexity Level

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