Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.04 Introducing the Formula Editor

Introducing the Formula Editor

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 reports where you need to build more complex filtering criteria? For those reports, there is the Formula Editor. Using the Formula Editor and writing formulas is described in complete detail in the next few chapters, but here is a summary of how to use it.

The Formula Editor lets you use the built-in programming language (either Crystal syntax or Basic syntax) to create sophisticated selection formulas. There is a large library of functions to choose from for building a selection formula.

When opening the Formula Editor from within the Select Expert, you are only given the option of using Crystal syntax as the programming language. As you will see in Chapter 5, Crystal Reports usually gives you the option of using Basic syntax, which is very similar to the Microsoft programming language Visual Basic. Unfortunately, the Formula Editor requires using Crystal syntax.

There are two ways to enter a custom formula. The first way is to click 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 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 list 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.