From what you have seen so far, the Select Expert is a very helpful tool for selecting one or more fields using the basic comparison operators. This is probably adequate for many of the reports you write. But what about the other reports where you need to build more complex filtering criteria? For those reports, there is the Formula Editor. The Formula Editor is described in complete detail in Chapter 7, but here is a summary of how to use it.
The Formula Editor lets you use Crystal syntax, the built-in programming language, to create sophisticated selection formulas. There is a large library of functions to choose from for building a selection formula. A simple example is when you don’t want to use the Select Expert’s default of requiring a field to match all the criteria selected. You can change the formula so that rather than use the default Boolean AND to join the conditions, it uses Boolean OR. Another example is rather than selecting a range of records based upon customer name, select the records based upon the first character of the customer name. This would let you choose all the customers with names starting with the letter “B”.
There are two ways to enter a custom formula. The first way is to click on the Show Formula button. This shows the existing formula built using the fields already selected. You can change this formula directly so that it matches the selection criteria you need. If you can’t remember the different built-in functions well enough to type them in directly, click on the Formula Editor button. This brings up the Formula Editor dialog box (discussed in Chapter 7) and you can use it as a reference tool to build the formula. The second way to enter a formula is to click on the comparison list dropdown box and at the very bottom is an item called formula:. Clicking on this item changes the right side to a multi-line text box that lets you type a formula from scratch.