Data Management Group  
 
TRAINER'S TALK

Boolean order of precedence in Crystal Reports In Crystal Reports, you can build complex formulas using the Boolean operators AND, OR, and NOT.

The information in the article applies to
Crystal Reports

Synopsis
In Crystal Reports, you can build complex formulas using the Boolean operators AND, OR, and NOT.

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
The following describes the Boolean order of precedence in Crystal Reports.

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'.



Have a question for our trainers?
Click here to send your questions!


Overview
Crystal Reports Tips & Tricks
Xcelsius Tips & Tricks
Web Intelligence Tips & Tricks
Trainer's Talk

Main | Company | Consulting | Training | Resources | Contact
Copyright © Data Management Group
All Rights Reserved.
DMG
11870 Fountain Way, Suite 502
Newport News, VA 23606
v. 888.394.1664
f. 757.578.4532
GSA Contract Number: GS-35F-0783N