Consultor Eletrônico



Kbase 21104: How To Do An 'Exclusive OR' (XOR)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

GOAL:

How to use an Exclusive OR (XOR).

FIX:

An XOR, called Exclusive OR, will return TRUE when each logical expression has a different logical value. That is:
A B A XOR B
----- ----- -------
False False False
False True True
True False True
True True False

Progress has three logical operators: AND, OR and NOT. Combining them users can do an XOR:

XOR = (OR) AND (NOT AND).

The next example displays all invoice records if the invoice.amount is less than 1000 OR the invoice.total-paid is less than 1000. It will exclude records where the invoice.amount and invoice.total-paid are both less than 1000.

FOR EACH invoice WHERE
(amount < 1000 OR total-paid < 1000) AND NOT
(amount < 1000 AND total-paid < 1000):

display invoice-num amount total-paid.
END.