This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
NOT
Dan Gorman edited this page Nov 29, 2018
·
6 revisions
NOT
returns the logical opposite of the argument it is passed.
NOT(arg1)
-
arg1
is an expression that can be interpreted as true or false (including numbers, strings, and arrays etc.)
Let's say we're given a response with some fleet deployment information that looks like this:
{
"data":{
"fleet_ready":{
"fleet_1": false
}
}
}
Or, if the API doesn't respond with a boolean value:
{
"data_2":{
"fleet_ready":{
"fleet_1": "not ready"
}
}
}
We can use NOT
to transform the return value in the first example into it's opposite:
NOT(data.fleet_ready.fleet_1)
This will return true
.
Since strings are interpreted as "true", we might want to transform "not ready" into "false". To do so, we can use `NOT:
NOT(data_2.fleet_ready.fleet_1)
This would return false
.
NOT
can also be used elegantly in combination with FILTER
or MAP
to sort results based on a given expression.