Expressions to filter, transform, and process event data - AWS IoT Events

Expressions to filter, transform, and process event data

Expressions are used to evaluate incoming data, perform calculations, and determine the conditions under which specific actions or state transitions should occur. AWS IoT Events provides several ways to specify values when you create and update detector models. You can use expressions to specify literal values, or AWS IoT Events can evaluate the expressions before you specify particular values.

Syntax to filter device data and define actions in AWS IoT Events

Expressions offer syntax for filtering device data and defining actions. You can use literals, operators, functions, references, and substitution templates in the AWS IoT Events expressions. By combining these components, you can create powerful and flexible expressions to process IoT data, perform calculations, manipulate strings, and make logical decisions within your detector models.

Literals

  • Integer

  • Decimal

  • String

  • Boolean

Operators

Unary
  • Not (Boolean): !

  • Not (bitwise): ~

  • Minus (arithmetic): -

String
  • Concatenation: +

    Both operands must be strings. String literals must be enclosed in single quotes (').

    For example: 'my' + 'string' -> 'mystring'

Arithmetic
  • Addition: +

    Both operands must be numeric.

  • Subtraction: -

  • Division: /

    The result of the division is a rounded integer value unless at least one of the operands (divisor or dividend) is a decimal value.

  • Multiplication: *

Bitwise (Integer)
  • OR: |

    For example: 13 | 5 -> 13

  • AND: &

    For example: 13 & 5 -> 5

  • XOR: ^

    For example: 13 ^ 5 -> 8

  • NOT: ~

    For example: ~13 -> -14

Boolean
  • Less Than: <

  • Less Than Or Equal To: <=

  • Equal To: ==

  • Not Equal To: !=

  • Greater Than Or Equal To: >=

  • Greater Than: >

  • AND: &&

  • OR: ||

    Note

    When a subexpression of || contains undefined data, that subexpression is treated as false.

Parentheses

You can use parentheses to group terms within an expression.