Data Management Group
Company Professional Services Solutions Technology Expertise Training & Education Resources
Resources










Contact Us

BI Advantage Newsletter

 

 

Boolean order of precedence in Crystal Reports

The information in the article refers to
Crystal Reports

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

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

 

Professional Services

To find out how we can help you solve your information challenges, visit our professional services pages:

Blueprint Analysis
Business Intelligence Implementation
Performance Management
Data Management
Business Intelligence Integration
Training and Education

Career Post Email


COMPANY | PROFESSIONAL SERVICES | SOLUTIONS | TECHNOLOGY EXPERTISE | TRAINING & EDUCATION | RESOURCES