Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
Dan Gorman edited this page Nov 29, 2018 · 6 revisions

The NOT Function

Function Group: Logical

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

Syntax

NOT(arg1)

  • arg1 is an expression that can be interpreted as true or false (including numbers, strings, and arrays etc.)

Uses

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.

Other Examples

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.

NOTES

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

Clone this wiki locally