Using Parameters with Record Selections

Now that you have completed the task of implementing a parameter field within a report, such as the report title, we will discuss 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, we will use the World Sales Report to implement the Country parameter field (created earlier in the hour) to filter the report results by including the parameter field within a record selection definition (using the Select Expert dialog). In this case, we will allow 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. This example demonstrates how a single report can be segmented many different ways:

  1. Verify that the Country parameter field is listed below the Parameter Fields group within the Field Explorer.

  2. Open the Select Expert dialog. The Select Expert dialog can be accessed from the Report menu by selecting the Select Expert command.

  3. Create a new record selection definition. Within the Select Expert dialog, click on the <New> tab to create a new record selection definition. This should present the Choose Field dialog. Choose Customer.Country from the Report Fields list and then click OK to return to the Select Expert dialog.

  4. Define the selection formula. Select Is Equal To from the drop-down list on the left, and then choose the { ?Country} option from the drop-down list on the right, as shown in Figure 12.10.

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

    graphics/12fig10.jpg

    graphics/bookpencil_icon.gif

    Parameter Field objects are denoted with the question mark, ?, and enclosed in brackets, {}. This convention is used within various application dialogs, including the formula workshop and record selections, to signify that these objects are parameter fields.


  5. 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 (represented by the lightening bolt icon). As shown in Figures 12.11 and 12.12, the report will now prompt the business user to select from a list of country values that will be used to filter the data retrieved by the report and present only the requested values in the report.

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

    graphics/12fig11.jpg

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

    graphics/12fig12.jpg

graphics/bookpencil_icon.gif

After the parameters have been created and implemented into a report, no extra effort is required for parameters to also work within the Crystal Enterprise solution. See Hour 23, Distributing Crystal Reports for more details on Crystal Enterprise.




Sams Teach Yourself Crystal Reports 9 in 24 Hours
Sams Teach Yourself Crystal Reports 9 in 24 Hours
ISBN: B003D7JUVW
EAN: N/A
Year: 2005
Pages: 230

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net