NOT

Top  Previous  Next

 

The NOT selection clause operator inverts the result of the immediately following condition.

 

 

Format

 

WITH NOT condition

 

where

 

conditionis a selection expression.

 

 

The NOT operator can be used to invert the result of a selection clause expression. For most expressions, it is easier and more readable to use the inverse operator but there are occasions when the NOT operator is the only way to achieve the desired effect.

LIST STAFF WITH NOT SURNAME = 'Smith'

is an alternative to

LIST STAFF WITH SURNAME # 'Smith'

 

If we wanted to use Soundex matching to include alternative spellings such as "Smyth", there is no inverse of the SAID operator but we could do

LIST STAFF WITH NOT SURNAME SAID 'Smith'

 

There is an important difference in QM's implementation of the NOT operator and that of other multivalue products. A query such as

LIST ORDERS WITH STATUS = "P" "D"

uses the implied OR to test STATUS against a list of values. This is equivalent to

LIST ORDERS WITH STATUS = "P" OR STATUS = "D"

 

Inserting a NOT operator to invert the test

LIST ORDERS WITH NOT STATUS = "P" "D"

associates the NOT only with the first value and is equivalent to

LIST ORDERS WITH NOT STATUS = "P" OR STATUS = "D"

 

Other multivalue products treat the list of status values as a single operation and apply the NOT to the result. In QM, it is necessary to write this as

LIST ORDERS WITH NOT (STATUS = "P" "D")

 

 

The NOT keyword can also be used as a synonym for NE

LIST ORDERS WITH STATUS NOT "P"