Skip to main content

NOT

The NOT function is a logical operator that returns the opposite value of a boolean expression.

If the expression is true, the function returns false; if the expression is false, the function returns true. If the input is null, the function will return null.

Syntax

bool? NOT(bool? condition)

Example

NOT(COMPARE("Apples", "Oranges"))

Will return true, as the COMPARE returns false.


NOT(ISNULL(MyColumn)

In this example, the function is used to check if a column value is null. The ISNULL function returns true if the column value is null, and false if it is not null. The NOT function then returns the opposite boolean value of the ISNULL function. So if the column value is null, the NOT function will return false, and if the column value is not null, the NOT function will return true.

This function can also be used to simplify complex boolean expressions by negating them. For example, if you have an expression like ((A AND B) OR C), you can use the NOT function to return the opposite value of the expression like this: NOT((A AND B) OR C).