Home > Articles > Data > BusinessObjects/Crystal Reports

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Using Parameters with Record Selections

Now that you have completed the task of implementing a parameter field within a report, you learn how a parameter field can also be used to filter the data retrieved by a report. Parameter values that business users enter can be used within record selection formulas to determine what data is retrieved from the database.

In the following exercises, use the same World Sales Report to implement the Countries parameter field (created earlier in the chapter) to filter the report results by including the parameter field within a record selection definition (using the Select Expert dialog). In this case, you enable the business user of the report to select one or more country values to be included in the record selection, thus filtering the report results to include only the desired data. The following steps demonstrate how a single report can be segmented many different ways:

  1. Open the Select Expert dialog by clicking the Report menu and choosing Select Expert.
  2. Create a new record selection definition. Within the Select Expert dialog, click on the <New> tab to create a new record selection definition. This opens the Choose Field dialog. Choose Customer.Country from the Report Fields list and then click OK to return to the Select Expert dialog.
  3. Define the selection formula. Select Is Equal To from the drop-down list on the left, and then choose the {?Countries} option from the drop-down list on the right, as shown in Figure 5.9.
    Figure 5.9

    Figure 5.9 Parameter fields can be added to record selection formulas quickly via the Select Expert dialog.

  4. Preview the report. To view how this parameter is now used within the generation of the report, run the report by clicking on the Refresh toolbar button. As shown in Figures 5.10 and 5.11, the report now prompts the business user to select from a list of country values that is used to filter the data retrieved by the report and present only the requested values in the report.
Figure 5.10

Figure 5.10 Business users can now select one or more countries to be included in the report results.

Figure 5.11

Figure 5.11 Based on the selected parameter field values, the report results display only the desired data.

  • + Share This
  • 🔖 Save To Your Account