The process of using parameter fields in reports includes two distinct steps:
The remainder of this chapter uses the example mentioned earlier, the World Sales Report, to create and implement parameter fields into a report. The World Sales Report is one of the many sample reports that are provided by the Crystal Reports installation.
Reviewing Parameter Field Properties
Before you learn how to create and implement parameter fields, it is useful to understand a few common properties associated with creating parameter fields. Each of the following properties is presented within the Create/Edit Parameter Field dialog, shown in Figure 5.2:
Figure 5.2. The primary parameter field properties are presented within the Create/Edit Parameter Field dialog.
Now that you have been exposed to the primary parameter field properties, you will use these items while creating parameters for a World Sales Report, as referenced earlier in the chapter.
Creating Parameter Fields
The first step in using parameters within a report is to create the actual parameter field and define the primary properties associated with it. In the following exercise, use the Field Explorer dialog to create two new parameter fields for the World Sales Report:
To begin your exercise, open the World Sales Report within the Crystal Reports designer. This sample report should be installed in the following directory, unless you have chosen an alternative location for the sample reports during the Crystal Reports 10 installation process:
C:Program FilesCrystal DecisionsCrystal Reports 10SamplesEnReportsGeneral Business
After you have opened this sample report, you can begin the steps necessary to create the parameter field objects in the following way:
Figure 5.3. Use the Group Sort Expert dialog to remove the Top N sort order from the report.
TIP
In addition to using the right-click menu to create a new parameter field, you can use the Field Explorer's toolbar commands to create, edit, rename, and delete parameter fields. The operations available on this toolbar depend on what you have selected in the Field Explorer dialog.
You first create a manual text-entry parameter field to enable the business user to define a title to display on the report.Figure 5.4. The Field Explorer is used to access, edit, and create parameter fields.
Figure 5.5. Use the Create Parameter Field dialog to create and edit parameter fields.
Setting Default Values for Parameter Fields
You now want to define the Countries parameter field to include all database values within the Country field of the Customer table. Map the parameter field to this database field and quickly import these values, enabling the business user of the report to select one or more country values from the available list.
When setting default parameter values, a list of default values can be read from the database or entered manually to provide the business user with a list of available values from which to choose. The Crystal Reports application enables you to define the default values list only when you are designing reports, and no direct database connection exists to populate the prompting parameter field list when the business users run the report. The following is an overview of various options available within the Set Default Values dialog to make data entry easier for the business users:
Mask Character |
Mask Description |
---|---|
A |
Requires entry of an alphanumeric character for its place in the parameter value. |
a |
Enables an alphanumeric character but does not require the entry of a character for its place in the parameter value. |
0 |
Requires a digit (0 to 9) for its place in the parameter value. |
9 |
Enables a digit or a space but does not require such an entry for its place in the parameter value. |
# |
Enables a digit, space, or plus/minus sign, but does not require such an entry for its place in the parameter value. |
L |
Requires a letter (A to Z) for its place in the parameter value. |
? |
Enables a letter but does not require such an entry for its place in the parameter value. |
& |
Requires a character or space for its place in the parameter value. |
C |
Enables any character or space but does not require such an entry for its place in the parameter value. |
., : ; - / (separator characters) |
Inserting separator characters into an Edit Mask is akin to hard-coding the formatting for the parameter field. When the field is placed on the report, the separator character appears in the field object frame, like this: L0L-0L0. This example depicts an edit mask for a Canadian Postal Code (such as M2M-2L5) with a forced display dash. |
< or > |
Forces subsequent characters in the parameter to be converted to lowercase (<) or uppercase (>). |
Forces the subsequent character to be displayed as a literal. |
|
Password |
Enables the setting of the Edit Mask to "Password," so that subsequent conditional formulas can specify that certain sections of the report become visible only when certain user passwords are entered. |
You now define the default values for your parameter fields (if necessary, refer to the list of options within the Set Default Values dialog while completing these steps):
Figure 5.6. The Set Default Values dialog enables you to define the default values for parameter fields.
Figure 5.7. The Define Description dialog enables you to create user-friendly descriptions for parameter selections that can be presented to users instead of potentially cryptic database values.
TIP
If you select a sort type from the Order list that does not match the parameter field value type, no sorting is applied.
TIP
There are a few considerations to keep in mind when working with parameter fields, such as
Implementing Parameter Fields
You have now completed the first task necessary to use parameter fields within a reportcreating the actual parameter field objects. This section, and the exercises included here, discuss how to apply these parameter fields and make use of them to provide the business user of the report with a more dynamic and interactive reporting experience.
First, implement the parameter field created earlier, called Title, to serve as the title to the report. This example demonstrates how a manual text entry field can be used to add useful commentary or descriptive information to a report. Continue working with the same report, the World Sales Report and follow these steps:
Figure 5.8. Drag and drop the Title parameter field into the upper-left corner of the Report Header A section.
Figure 5.9. Parameter fields offer a means to add additional interactivity for the business users within the report.
NOTE
If you have already run the report at least once and then select to refresh the report, you will also see the Refresh Report Data dialog that asks you to select from the following two options:
To enter or select new values for any existing parameter fields, you need to select the second optionPrompt for New Parameter Values.
Part I. Crystal Reports Design
Creating and Designing Basic Reports
Selecting and Grouping Data
Filtering, Sorting, and Summarizing Data
Understanding and Implementing Formulas
Implementing Parameters for Dynamic Reporting
Part II. Formatting Crystal Reports
Fundamentals of Report Formatting
Working with Report Sections
Visualizing Your Data with Charts and Maps
Custom Formatting Techniques
Part III. Advanced Crystal Reports Design
Using Cross-Tabs for Summarized Reporting
Using Record Selections and Alerts for Interactive Reporting
Using Subreports and Multi-Pass Reporting
Using Formulas and Custom Functions
Designing Effective Report Templates
Additional Data Sources for Crystal Reports
Multidimensional Reporting Against OLAP Data with Crystal Reports
Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design
Introduction to Crystal Repository
Crystal Reports Semantic Layer Business Views
Creating Crystal Analysis Reports
Advanced Crystal Analysis Report Design
Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting
Part V. Web Report Distribution Using Crystal Enterprise
Introduction to Crystal Enterprise
Using Crystal Enterprise with Web Desktop
Crystal Enterprise Architecture
Planning Considerations When Deploying Crystal Enterprise
Deploying Crystal Enterprise in a Complex Network Environment
Administering and Configuring Crystal Enterprise
Part VI. Customized Report Distribution Using Crystal Reports Components
Java Reporting Components
Crystal Reports .NET Components
COM Reporting Components
Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition
Introduction to Crystal Enterprise Embedded Edition
Crystal Enterprise Viewing Reports
Crystal Enterprise Embedded Report Modification and Creation
Part VIII. Customized Report Distribution Using Crystal Enterprise Professional
Introduction to the Crystal Enterprise Professional Object Model
Creating Enterprise Reports Applications with Crystal Enterprise Part I
Creating Enterprise Reporting Applications with Crystal Enterprise Part II
Appendix A. Using Sql Queries In Crystal Reports
Creating Enterprise Reporting Applications with Crystal Enterprise Part II