15. VIFRED Field Specifications : Specify a Validation Check : Comparison Operator Validation Checks : Boolean Operators in Validation Checks
Share this page                  
Boolean Operators in Validation Checks
This chapter has discussed the following validation comparison types:
Simple relational operator comparisons
Comparison to a list of values
Comparison to a lookup table
You can create more complex validation checks by using Boolean operators to connect any of these validating comparison types. The syntax for using the Boolean operators is:
expression OR expression
expression AND expression
NOT expression
The parameter expression is any of the previously discussed validation comparison types. For example, the following validation check forces a user to enter a number into the Code field that is either less than 21 or is 25, 30, or 35:
code < 21 or code in [25, 30, 35]
To allow additional flexibility, you can use parentheses to group Boolean expressions to achieve the desired semantics in the validation check. For instance, the following example forces a user to enter a number into the code field that is less than or equal to 20000 into the Salary field unless the Grade field is greater than or equal to 7. In this case, the user can enter a number up to 30000:
salary <= 20000 or (grade >= 7 and salary <= 30000)
Boolean conjunction
Boolean disjunction
Boolean negation
Negation (NOT) has precedence over conjunction (AND) and disjunction (OR); AND and OR have equal precedence.
Some example character strings with Boolean operators are:
manager = "Jones" OR manager = "Ortega" AND NOT manager = "Fisher"