XOR

A XOR statement returns a logical 'Exclusive Or' of all arguments. XOR gives TRUE only when the conditions return different truth values.

ArgumentsResult

1 or more test conditions return different results (TRUE and FALSE)

TRUE

All the conditions are TRUE

FALSE

All the conditions are FALSE

FALSE

Syntax

XOR(logical_test1, ...logical_test2?)

Arguments

ArgumentsData typeDescription

logical_test1

Node reference,number

The first condition to be evaluated. This is a required argument.

logical_test2?

Node reference,number

The additional conditions to be evaluated. These are optional arguments.

Return Value

Either True or False.

Remarks

OR : If at least 1 of the conditions is TRUE, the result is TRUE.

XOR : If only 1 of the conditions is TRUE, the result is TRUE but if both the conditions are TRUE the result is FALSE. XOR returns TRUE only if the conditions give different results, if both give the same results, XOR returns a FALSE.

Example

Consider the below scenario, where the price should be 20, if either Sales Quantity is greater than 50 or Customer Ranking = 1, but not both. It should be 25 otherwise.

To achieve this, the following formula should be written on the [Price] node:

IF(XOR([Sales Quantity]>50,[Customer Ranking]==1),20,25)

Result

As you can see from the above table, the result will be 20 when either of the conditions is true and it will be 25 when both the conditions are true/false. In Feb, both the conditions are TRUE so the result is False and the corresponding value for FALSE is returned which is 25. In Mar, both the conditions are FALSE so again the result in 25. Whereas in Jan, only 1 of the arguments is TRUE so the value will be 20.

Last updated