Using comparison functions in formula expressions - Amazon IoT SiteWise
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Using comparison functions in formula expressions

In transforms and metrics, you can use the following comparison functions to compare two values and output 1 (true) or 0 (false). Amazon IoT SiteWise compares strings by lexicographic order.

Function Description

gt(x, y)

Returns 1 if x is greater than y, otherwise 0 (x > y).

This function doesn't return a value if x and y are incompatible types, such as a number and a string.

gte(x, y)

Returns 1 if x is greater than or equal to y, otherwise 0 (x ≥ y).

Amazon IoT SiteWise considers the arguments equal if they are within a relative tolerance of 1E-9. This behaves similar to the isclose function in Python.

This function doesn't return a value if x and y are incompatible types, such as a number and a string.

eq(x, y)

Returns 1 if x is equal to y, otherwise 0 (x == y).

Amazon IoT SiteWise considers the arguments equal if they are within a relative tolerance of 1E-9. This behaves similar to the isclose function in Python.

This function doesn't return a value if x and y are incompatible types, such as a number and a string.

lt(x, y)

Returns 1 if x is less than y, otherwise 0 (x < y).

This function doesn't return a value if x and y are incompatible types, such as a number and a string.

lte(x, y)

Returns 1 if x is less than or equal to y, otherwise 0 (x ≤ y).

Amazon IoT SiteWise considers the arguments equal if they are within a relative tolerance of 1E-9. This behaves similar to the isclose function in Python.

This function doesn't return a value if x and y are incompatible types, such as a number and a string.

isnan(x)

Returns 1 if x is equal to NaN, otherwise 0.

This function doesn't return a value if x is a string.