Crystal Reports 10: The Complete Reference

Overview

If you are designing reports to distribute to a viewer audience that may not be familiar with Crystal Reports or the Select Expert, you will soon have the need to prompt the viewer for values that affect record selection, conditional formatting, or some other ad hoc information. This becomes even more crucial when the viewer doesn t actually have a copy of Crystal Reports but wants to view a report presented in some turnkey fashion, such as an on-demand report run on the Web with Crystal Enterprise (discussed in Part II of this book). In these situations, the viewer won t have the ability to make changes with the Select Expert anyway.

The ideal solution for these types of ad hoc reporting requirements would be to present the viewer with a dialog box prompt, preferably including a choice of default values or a range of values, to help the user enter the correct values for the prompt. The response the viewer provides could then be passed to the Select Expert to customize record selection and formatting, and the values the viewer supplied could also be included on the report to indicate what data makes up the report.

This ideal solution is made possible by parameter fields, prompts that are presented to the viewer when he or she refreshes the report. The value the viewer provides is then passed on to the Select Expert, report formulas, or conditional-formatting formulas to customize the way the report appears, based on the viewer s response. The viewer doesn t have to know how to enter selection criteria or conditional formulas to customize the way the report behaves.

Consider the following report:

This report uses three fields in record selection:

These criteria are hard-coded into the Select Expert, and text objects appear in the report header to indicate the restrictions.

The difficulty comes when you want the person reviewing the report to be able to easily change these criteria whenever the report is refreshed. The way this report is currently designed, the viewer must have the ability to alter record selection (and know enough about its intricacies to be able to change it). That person also must be able to edit the text object that displays what records are included. Even in this case, it s time-consuming to change this information every time the viewer wants to change these options. Parameter fields are the answer.

Using parameter fields is, at minimum, a two-step process. The third step is optional:

  1. Create the parameter field.

  2. Use the parameter field in record selection.

  3. Place the parameter field on the report, perhaps embedded in a text object, to indicate what is included on the report.

Категории