DEFAULT

Allows you to specify a fallback in case a value doesn’t exist.

Syntax 

DEFAULT(value, value_if_false)

Examples 

Example 1

Input

{
  "my_action": {
    "message": []
  }
}

Formula

DEFAULT(my_action.message, "fallback")

Output

"fallback"
Example 2

Input

{
  "my_action": {
    "message": [
      1
    ]
  }
}

Formula

DEFAULT(my_action.message, "fallback")

Output

[
  1
]
Example 3

Input

{
  "my_action": {
    "message": ""
  }
}

Formula

DEFAULT(my_action.message, "fallback")

Output

"fallback"
Example 4

Input

{
  "my_action": {
    "message": "hello world"
  }
}

Formula

DEFAULT(my_action.message, "fallback")

Output

"hello world"
Example 5

Input

{
  "my_action": {
    "message": "hello world"
  }
}

Formula

DEFAULT(my_action.does_not_exist, "fallback")

Output

"fallback"
Example 6

Input

{
  "my_action": {
    "message": false
  }
}

Formula

DEFAULT(my_action.message, "fallback")

Output

"fallback"
Was this helpful?