Data Management Group Crystal Reports Training Boot Camp
Business Objects Authorized Education Partner
Home Corporate Information Training And Education Resources

Business Objects Top Authorized Education Partner for 2004 - View Our Courses

HOME
CORPORATE INFORMATION
TRAINING AND EDUCATION
RESOURCES>>>
RESOURCES > Trainer's Talk > Boolean order of precedence in Crystal Reports

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

 

Sign Up for the BI Advantage Newsletter