Crystal Reports - Apply Boolean Formulas


Advertisements

There are different Boolean operators that can be used in formula in Crystal Reports. They are −

  • AND
  • OR
  • NOT
  • Eqv
  • Imp
  • XOR

All these operators are used to pass multiple conditions in formulas −

Boolean Operators

AND operator is used when you want both the conditions in the formula to be true. Other Boolean operators and their meaning is as mentioned in the above snapshot.

Using Boolean Operators ‘AND’ −

If {CUSTOMER.CUSTOMER_NAME} [1 to 2] = "AN" and

ToText({CUSTOMER.CUSTOMER ID}) [2] = "4" then

"TRUE"

Else

"FALSE"

Using Boolean Operators ‘AND’ and ‘OR’ −

If ({CUSTOMER.CUSTOMER_NAME} [1 to 2] = "AN" and

ToText({CUSTOMER.CUSTOMER ID}) [1] = "4") or

({CUSTOMER.CUSTOMER_NAME} [1 to 2] = "Ja" and

ToText({CUSTOMER.CUSTOMER ID}) [1] = "2") then

"Five star rating CUSTOMER"

Else

"1 star rating CUSTOMER"
Advertisements