|
|||||||||
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Use XOR to Perform Exclusive ORNow you can be an "XORcist" when you do your Crystal Reports! Use an exclusive OR to select data. Most report designers are comfortable with basic selection criteria. They will combine multiple clauses with “AND” and “OR” operators to select the data they want in a report. Sometimes you may want records that meet one or other criteria, but do not want records that meet both or neither criteria. Here is a Boolean operator not often used. You can use XOR to perform an Exclusive Or. An example would be This will select everyone in dept ABC or anyone in other departments with a qualification of XYZ, but will ignore the people in Dept ABC who already have a qualification of XYZ. But what if you want to do the exact opposite? No problem! You can use the XOR Boolean operator to combine two Boolean clauses and return TRUE if one of the clauses is true--but false is both or neither are true. If you require the opposite result use the EQV operator inside your formula. That is, use EQV if you want records that meet both or neither criteria, but do not want records that meet one or the other criteria.
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects. |
|
Boolean Simplified Some people are intimidated by Boolean, but the truth is it's very simple. Here are the basics. Electronic circuit designers have the good fortune to work with Boolean represented by discrete symbols representing actual physical components. So, for example, the AND operator is the AND gate. The basic components are called gates. Draw them out on paper: AND. Draw a big letter D. Add two inputs on the left and an output on the right: =D- That approximates the Boolean AND symbol for a two-input, one-output AND. When both inputs are true, the output is true. If only one input is true, the output is false. True or false are just different ways of saying 1 and 0 (respectively). On the electronic component, both inputs must have the logic voltage (a logic 1) for the output to have the logic voltage. The AND can have any number of inputs. Maybe you need 21 conditions to all be true before changing the output to true. Such a scheme is common in control circuits, where you need permissives to all check OK (safety switches 1 - 10 are closed, exhaust damper is open, drain valve is closed, etc.) before you can start the system. The OR gate is very similar. But instead of a D, you have a triangle (same orientation, flat side on the input, "arrow" end on the output). You need just one of these to be true for the output to be true. But what if you need two of these to be true? Then put those two conditions on an AND and feed that output to the OR. Then there's the NOT gate. It's a small o, which you can draw on the line coming into another gate if you wish. It just inverts, so a 0 becomes a 1 (whether input or output). You can use this to build NOR gates, NAND gates, and various combinations thereof. You can use it to say if X is false (NOT the input), then no permissive. Or if X is true, then no permissive (NOT the output of an OR). So if you're confused by Boolean, just draw it out using the basic symbols and functions. It's a very useful way to build logic. And not just for electronic circuits and Crystal Reports, but for any kind of logical examination of any problem or issue. |