<< Click to Display Table of Contents >>
The Expression Builder is an important part of ReportPro's design interface, and you will encounter it frequently as you create reports. ReportPro uses expressions extensively for a variety of purposes such as retrieving information from a data source and making decisions during the printing process. Think of an expression as a series of commands that instruct ReportPro how to perform a task.
The Expression Builder window consists of a series of tabs across the top of the window and a large edit control at the bottom. Each tab contains a different piece of information that can be used to build an expression. The Fields tab (shown above) contains a list of all the database fields that are available in the current section. The Functions tab contains a list of the functions that are supported by ReportPro. The Variables tab contains the list of user defined variables. You build an expression by combining information from these three tabs in the edit control at the bottom. There are two ways to copy information from the tabs to the edit control. The first is to double-click the desired piece of information. Doing so places the piece of text that you double clicked in the edit control at the location where the edit control cursor (the flashing vertical bar) is located. If there is highlighted text in the edit control, it is replaced with the text that you clicked on. The other method for copying information is to click the desired piece of information with the left mouse button and drag it into the edit control.
Between the tabbed windows at the top of the Expression Builder and the edit control at the bottom is a series of speed buttons that can be pressed to quickly enter text into your expression. These buttons serve no other purpose than to provide a short cut for typing common pieces of text.
In the bottom right corner of the Expression Builder are several additional buttons. The Test button provides a way for you to test your expression as you build it. If you are building a complex expression, it is a good idea to test the expression as you go. A simple expression is much easier to debug than a large complex one. The Clear button simply deletes all the text in the Expression Builder edit control.
When you have finished building your expression, press the OK button to save your new expression. ReportPro will automatically test your expression to make sure that it is valid. If ReportPro detects an error, you will be informed of the error and given the option of fixing it before you leave the Expression Builder. Pressing the Cancel button will return you back to the ReportPro work window without saving any changes.
The Fields tab contains two additional controls that can help you build your expressions. The first control, which is located at the bottom left of the Fields tab, is the Field Browser button. When pressed, this button will display a dialog that shows sample data for the field that is highlighted in the Fields tab. This feature is useful because it is not always easy to remember the data type of all fields in a database. The other control is a combo box on the bottom right side of the Field tab. It contains a list of the database tables that are being used by the current section. When a table is selected in this control, the Fields tab is refreshed to show only those fields from the selected table. This feature is very useful when your report contains many tables.