The previous chapter showed you how to make reports easier to read by sorting and grouping the data. This made it possible to break down large amounts of data into smaller and easier to understand sections. Another way to make it easier to understand reports is by filtering out unnecessary data prior to printing the report. Filtering data lets you customize the report to the user’s preferences so that only information specific 2to their current needs is shown.
Filtering data consists of two levels. The first level uses the Select Expert to specify which data to print on the report and which data should be filtered out. But the Select Expert by itself only creates a static selection formula. It doesn’t take into account the user’s preferences. So the second level builds upon the Select Expert by creating parameters that query the user for the specific data they need. These preferences are used within the selection formula so that the report is customized to the user’s needs.
This chapter first shows you how to filter data using the Select Expert and then shows you how to create advance filters using parameters. Parameters are covered in great detail because they are also used within report formulas and for custom formatting. The effective use of parameters within record selection formulas and custom formatting lets you create dynamic reports that are tailored to each specific user.
Selecting Records
Prior to this chapter, reports have selected records from a table without regard to selecting specific data. It was assumed that you wanted to display every record in the table. While this is true some of the time, it is more the exception than the rule. You frequently need to filter data so that only a subset of records gets printed.
Here are a few examples of reports that select data for a specific purpose:
- A sales report shows the sales figures for a specific region or sales person. Another shows data for a specific month and groups it by sales person.
- A user is prompted to enter their User ID and Password and a payroll report uses their security level to determine what salary information should be printed.
- An Inventory Alert report shows products whose inventories are below the required minimum level. The purchasing department uses this report to order products that are at risk of going out of stock.
Crystal Reports makes selecting records easy. It provides a Select Expert that lets you pick one or more fields and set a selection formula for each field. Each record in the database is evaluated with the selection formula and this determines whether it appears on the report or not. The Select Expert dialog box is similar to other Crystal Report experts and is easy to learn.