Logical operators - AWS IoT SiteWise

Logical operators

AWS IoT SiteWise supports the following logical operators.

Operator

Signature

Description

AND

a AND b

TRUE if both values are true

OR

a OR b

TRUE if one value is true

NOT

NOT expression

TRUE if an expression is false, and FALSE if an expression is true

IN

x IN expression

TRUE if value in expression

BETWEEN

BETWEEN a AND b

TRUE if value between upper and lower limit, and includes both limits

LIKE

LIKE pattern

TRUE if value is in pattern

LIKE supports wildcards. See below for examples:

  • % substitutes one or more characters in a string.

  • _ substitutes one character in a string.

  • ESCAPE is used with a character to designate an escape character in the LIKE pattern.

Examples of all logical operators:

Function

Example

AND

SELECT a.asset_name FROM asset AS a, latest_value_time_series AS t WHERE t.int_value > 30 AND t.event_timestamp > TIMESTAMP '2025-05-15 00:00:01'

OR

SELECT a.asset_name FROM asset AS a WHERE a.asset_name like 'abc' OR a.asset_name like 'pqr'

NOT

SELECT ma.asset_id AS a_id FROM asset AS ma WHERE (ma.asset_id NOT LIKE 'some%patterna%' escape 'a') AND ma.asset_id='abc'

IN

SELECT a.asset_name FROM asset AS a WHERE a.asset_name IN ('abc', 'pqr')

BETWEEN

SELECT asset_id, int_value, event_timestamp AS i_v FROM raw_time_series WHERE event_timestamp BETWEEN TIMESTAMP '2025-04-15 00:00:01' and TIMESTAMP '2025-05-15 00:00:01'

LIKE

  • % pattern:

    SELECT POWER(rw.int_value, 5) AS raised_value FROM raw_time_series AS rw WHERE rw.asset_id LIKE 'some%pattern%' AND rw.int_value > 30
  • _ pattern:

    SELECT asset_id, property_id FROM asset_property WHERE string_attribute_value LIKE 'Floor_'
  • ESCAPE pattern:

    SELECT asset_id FROM asset WHERE asset_name LIKE 'MyAsset/_%' ESCAPE '/'