| The information in the article refers to |
| Applies to |
| Synopsis |
When two or more Boolean operators are present in a formula, the order in which they are processed is known as precedence.
What is the Boolean order of precedence in Crystal Reports?
| Solution |
NOT is processed before AND, and OR is processed last. If a query has two or more operators of equal precedence, the leftmost operator is processed first. However, parentheses can be used to override these rules.
The following lists the Boolean order of precedence in Crystal Reports:
1st: ( )
2nd: * / + -
3rd: NOT
4th: AND
5th: OR
For example:
- {db.doc type} = 'book' OR {db.doc type} = 'review' AND {db.author} = 'Smith'
This formula finds all records where the document type is 'book', or where the document type is review and an author is named 'Smith'. - ({db.doc type} = 'book' OR {db.doc type} = 'review' ) AND {db.author} = 'Smith'
This formula finds all records where the document type is books or reviews, where an author is named 'Smith'.






