NOT

NOT returns the logical opposite of the argument it is passed.

Function category: Logical

NOT can also be used in combination with FILTER or MAP to sort results based on a given expression.

Syntax

NOT(arg1)

Arguments

Description

arg1

Expression that can be interpreted as true or false (including numbers, strings, and arrays etc.)

Examples

Example 1: Transform a value into its opposite value

Let's say we're given a response with the following fleet deployment information:

{
"data":{
"fleet_ready":{
"fleet_1": false
}
}
}

We can use NOT to transform the return value in the first example into it's opposite value:

NOT(data.fleet_ready.fleet_1)

This returns the following:

true

Example 2: Transform a string to boolean

Let's say the API doesn't respond with a boolean value but provides a string, as in the following:

{
"data_2":{
"fleet_ready":{
"fleet_1": "not ready"
}
}
}

Since strings are interpreted as true, we can transform "not ready" in "false" using NOT:

NOT(data_2.fleet_ready.fleet_1)

This returns the following:

false