Chapter 14: Viewer Interaction with Parameter Fields


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:

click to expand

This report uses three fields in record selection:

  • Order Date Filtered with a Between selection criterion to include orders that were placed during 2001 (between January 1 and December 31).

  • Region Filtered with a One Of selection criterion to include orders placed from AL, AR, AZ, CO, CT, and DC.

  • Customer Name Filtered with a Like selection criterion to include customer names that contain the string Bik.

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.




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

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