Understanding Conditions in Finds
Conditions are used in Finds to determine which records are returned as results when the find is conducted.
To understand how to define conditions used in finds, review the sections below.
Note: The concepts in this section are similar for Notifications and Finds. If you have read and understood this information in another part of the guide, you may skip this section.
The condition editor provides the tools necessary to construct logical expressions (also called criteria) that are evaluated by the system to find objects in the database.
Each logical expression used in a condition is composed of the following distinct elements:
The purpose of these elements is to provide the syntax by which one operand is evaluated against another operand. The means by which the operands are evaluated against each other is called the relational operator. For example, in the mathematical expression “6 > 2”, the numbers “6” and “2” are the operands and the greater-than symbol (“>“) is the relational operator. In , the numerical operands of the mathematical expression “6 > 2” are replaced by the contents of database fields, text, and in some cases, MetaScript. In the example above “6 > 2” is replaced by “Job Number greater than 1000”. When the above logical expression is evaluated by , the value indicated by the Job Number database field (first operand) is evaluated against the value indicated by the second operand (the number 1000) to see if the prior is greater-than the latter.
When evaluated by the system, conditions always evaluate to one of two possible outcomes: True or False. When the find condition evaluates to True for a record in the database, the system includes the record in the results of the find. Additional details on constructing conditions for finds can be found in “Searching for Information with Finds” on page 219.
Up until this point, our discussion of conditions in have used simple examples with each condition composed of one logical expression/criterion. provides you with the capability to define compound conditions in your Finds. That is, you can define conditions composed of multiple logical expressions.
Logical expressions in a compound condition are related to each other by one of two boolean operators: AND or OR. When compound conditions are evaluated by the system, the entire compound condition resolves to either True or False. When multiple logical expressions are related to each other by an AND boolean operator, each logical expression in the compound condition must evaluate to True for the entire (compound) condition to evaluate to True. When multiple logical expressions are related to each other by an OR boolean operator, only one of the logical expressions must evaluate to True for the entire compound condition to evaluate to True.
In the case of compound conditions that use both AND and OR boolean operators, an understanding of the system’s order of operations is essential to understanding how to define the logical expressions/criteria in your compound conditions and how the system will evaluate them.
Order of operations refers to the order in which conditions are processed by the system. In the case of compound conditions composed entirely of AND or OR boolean operators, logical statements/criteria in the condition are evaluated sequentially from top to bottom. In the case of compound conditions composed of mixed (AND and OR) boolean operators, the conditions are evaluated a little differently: In , the boolean operator AND has a higher priority than OR. For example, the notification condition:
will be interpreted by the system as “(Criterion1 AND Criterion2) OR Criterion3. In this example, both Criterion1 and Criterion2 must evaluate to True, or Criterion3 must evaluate to true for the compound condition to evaluate to True.
If you would like the notification condition to be interpreted as “Criterion1 AND (Criterion2 OR Criterion3)”, you must define the notification condition as follows:
A notification routine with this send condition will generate a notification only when either Criterion1 and Criterion2 are both true or when Criterion1 and Criterion3 are both true.