Friday 21 April 2017

Crystal Reports : The Exclusive OR

Most of you will have been comfortable using just "AND" and "OR" as boolean operators when creating crystal formulas. Once in awhile, however, we will need to use the "XOR" operator. This "exclusive" OR will only return TRUE if either of the conditions is true, yet return FALSE if both or none of the conditions is true.
Let us imagine a user database that tracks software class certifications. There are two fields, {USERS.CLASS1} AND {USERS.CLASS2}, which represent two classes any one user may have taken. To determine which users have completed just ONE (i.e. field is not null) class, but not BOTH or NONE, use the "XOR" operator thus:

ISNULL({USERS.CLASS1}) = TRUE XOR ISNULL({USERS.CLASS2}

No comments:

Post a Comment

Control Structures (Crystal Syntax) In Crystal Report : If Expressions (Crystal Syntax) in Crystal Report

Formulas without control structures execute each expression in the formula exactly once when the formula is evaluated. The expressions are...