A Singapore Government Agency Website

Context

Context is a special global data type that mirrors the structure of the JSON input provided to the node. Its properties can be accessed using dot notation (.), bracket notation ([]), or array indexing.

Data Access


Given the following input structure:

{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "groups": ["admin", "user"],
    "age": 34
  }
}

Dot notation

customer.firstName;     // "John"
customer.lastName;      // "Doe"
customer.groups;        // ["admin", "user"]
customer.age;           // 34

Bracket notation

customer["firstName"];  // "John"
customer["age"];        // 34

Array indexing

customer.groups[0];     // "admin"
customer.groups[1];     // "user"

Expressions with Context


To build on concepts from earlier sections, you can also write expressions such as:

customer.firstName + " " + customer.lastName // "John Doe"
customer.age in [30..40] // true
contains(customer.groups, "admin") // true
customer.nickname ?? "Guest" // null coalescing

Decision Table Column Reference ($)


In Decision Table input columns, $ represents the current column’s tested value. This allows you to write conditions in shorthand:

$ > 100                  // equivalent to: columnValue > 100
$ in [1..10]             // equivalent to: columnValue in [1..10]
isNumeric($) and number($) > 0

Tip: $ is only available inside Decision Table input column expressions. In other contexts, reference your data directly by its property name.

Chat with me!
Bot Launcher