Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
|
The addition of parameter fields to your report actually consists of two parts. The first is to create the parameter field. The second is to then incorporate it into your report.
To create parameter fields, access the Field Explorer window. Then right-click on the Parameter Fields node. An options menu displays. Select New from the options menu. The Create Parameter Field dialog box displays, as shown in Figure 11-1.
The following table summarizes the different functionality of the Create Parameter Field dialog box.
Field | Description |
---|---|
Name | The name you create for your parameter field. |
Prompting text | The text statement or question that displays to your report users at the parameter prompt. |
Value type | The list of data types that define the type of records your parameter shall filter (for example: String, Boolean, Currency, Date, DateTime, Number, and Time). |
Allow multiple values | Allows report users to enter multiple records at the parameter prompt. |
Discrete value(s) | Allows report users to enter a single value at the parameter prompt. |
Range value(s) | Allows report users to define a range, using starting and ending values, at the parameter prompt. |
Discrete and Range Values | Allows report users to enter a single value, as well as a range (using the starting and ending values) at a parameter prompt. |
Allow editing of default values... | Allows report users to edit any default values provided within the parameter prompt. |
Set default values | Allows you (the report designer) to specify the default parameter values that display within the parameter prompt. These values may be based on a database field, an external pick list, or a manual entry. |
To begin exploring parameter fields, use the report you created in the last chapter. Open the EmplOrders.rpt file you saved from Chapter 10 or access the report from the companion files (www.wordware.com/files/crystal). Make sure you're in the Create Parameter Field dialog box (found in the Field Explorer pane).
-
In the Name field, type Report Title.
-
In the Prompting text field, type Please Enter the Report Title:.
This defines the text that displays each time the user refreshes the report.
-
In the Value type drop-down field, select String.
Your screen should look like Figure 11-2.
Figure 11-2: Creating a parameter field -
Press the OK button on the Create Parameter Field dialog box.
You're returned to the Report Design area.
-
From the Field Explorer pane, expand the Parameter Fields node.
You'll notice the Report User parameter you just created now exists within this node.
-
Drag the Report Title parameter field to the Report Header section.
You can place the field at the 0" mark, so that it's lined up with your report's left margin. Once you place this parameter field, you'll notice an Enter Parameter Values dialog box display, as shown in Figure 11-3.
Figure 11-3: The Enter Parameter Values dialog box
Every time you refresh your report, this dialog box displays.
Go ahead and type in the following title: Employee Orders Report; run by [your name here]. Then, press the OK button. You'll need to resize and increase the title to make it look correct (as you learned in Chapter 5). Figure 11-4 displays what your report might look like.
|