Logical Operators

When a Condition is added to another compound conditional statement, the newly added Condition will be ANDed to the Condition already present:

Example:

If Filename = bob.txt

Now add another Condition:

If Filename = bob.txt and If Filesize < 100 MB

When the second Condition being added is the SAME Condition type as the previous one, the newly added Condition will be ORed to the previous Condition.

If Filesize < 200 MB

Now add another same Condition:

If Filesize < 200 MB or If Filesize > 500 MB

If there are more than two Conditions already existing in a compound Conditional line, and another Condition is added (regardless of Condition type), the new Condition will use the same logical operators that are already present for that compound statement.

If Filesize < 200 MB or If Filesize > 500 MB

Now add another same Condition:

If Filesize < 200 MB or If Filesize < 400 MB or If FileName = rob.txt

You can change the AND and OR operator values by clicking the and or the or hyperlink. Please note that logical operators separating conditional statements must be the SAME across the entire compound statement. You cannot mix and match AND and OR statements. When changing the logical operator for a compound conditional statement, ALL subsequent logical operators for that statement also change to match that operator. This is necessary to prevent problems with evaluation precedence, especially in conditional blocks with more than 2 conditional expressions to evaluate. There are ways around this limitation, discussed in Evaluating Expressions.

Example:

If Filename = bob.txt

Now add another Condition:

If Filename = Bob.txt and If Filesize < 100 MB

Now add another Condition:

If Filename = Bob.txt and If Filesize <100 MB and If group is one of Admins

Now click one of the AND hyperlinks to change it to OR. Resulting line:

If Filename = Bob.txt OR If Filesize <100 MB OR If group is one of  Admins

Example:

If Filesize is < 200 MB

Now add another Condition:

If Filesize < 200 MB or If Filesize > 500 MB

Now click the OR hyperlinks to change it to AND. Resulting line:

If Filesize < 200 MB and If Filesize > 500 MB

Note that in the second example, the statement will never evaluate to true. You must change the comparison types or the comparison values, or switch back to the OR logical operator to avoid creating expressions that can never evaluate to true.

Related Topics

Using Conditions

Adding a Condition to an Event Rule

Condition Placement

Changing Condition Placement

Condition Evaluation

Else Clauses

Evaluating Expressions

The Compound Conditional Statement

List of Conditions