Exercise three: Using question fields
In exercise three, we’ll create a new report and use a question field to print only plants with a user-specified sun requirement.
Creating a new report
|
1.
|
Select Operations > Create new report. |
|
2.
|
Enter “PLANTS BY SUN REQ” in the Report name field and press Enter. |
|
4.
|
Select Plant item file. |
|
5.
|
Press the Exit shortcut. |
Selecting fields to print
|
1.
|
Select Design > Fields to print. |
|
2.
|
Select Size in gallons and Common name, then page down and select Average cost and Retail Price. |
|
3.
|
Press the Exit shortcut. |
If you’d like, you can move the fields around so that the Common name field is the first field in the report, as shown in figure 1. If you need help, see Reordering fields. You can also change the field headings; see Changing a field heading.
|
4.
|
Press the Exit shortcut again. |
Creating a question field
Now we’ll specify which records we want included in the report. In the first and second exercises, we included all records. For this report, we’re going to create a question field so that the user can specify which records will be printed.
Question fields are a powerful mechanism for customizing reports. For example, if your users need to print customer listings by state, you don’t have to create and store 50 reports (one for each state). Rather, you can create a question field that prompts the user for the state to include on the report.
For this report, we’re going to prompt the user for the sun requirements of the plants to include in the report. Because the sun requirements are stored in the file as “FULL,” “PART,” “SHADE,” or “ANY,” we’ll need to create an alphanumeric field.
|
1.
|
Select Design > Fields to create to display the Available Field Types list. |
|
2.
|
Select Question Fields. |
|
3.
|
Select Alphanumeric from the Question Field Type field to display the Question Field Definition window. (See figure 2.) |
|
4.
|
Enter “SUNREQ” in the Field name field. |
|
5.
|
Press Enter in the Description field to accept the default. |
|
6.
|
In the Prompt field, type “Enter the sun req. for this report” (without quotes). This is the prompt the user sees on the screen when generating the report. |
|
7.
|
In the Required field, select Yes and then press Enter. |
|
8.
|
Press Enter to skip the Format field. Our field doesn’t require a format. (You might enter a format if the user were entering numeric data that you wanted displayed with the appropriate commas and periods.) |
|
9.
|
In the Default field, press Enter. This field is used to display a default value in the question field. |
|
10.
|
In the Info line field, enter “Valid choices are FULL, PART, SHADE, or ANY.” This text displays at the bottom of the screen when the user generates the report. You’ll most commonly use this area for short help messages. |
|
11.
|
Enter “5” in the Length field. |
|
12.
|
Select Y for Uppercase and press Enter. |
|
13.
|
Press Enter in the Justification field to accept the default justification (left). |
|
14.
|
Press the Exit shortcut (or click OK on Windows). |
Now that we’ve created our question field, as shown in figure 2, let’s use it to make selections for our report.
Defining a selection criterion
We need to relate the data the user enters (FULL, PART, SHADE, or ANY) to the records in the data file, as shown in figure 3.
|
1.
|
Select Design > Selections to make. |
|
2.
|
Select Field functions > List selections. A list of available fields displays. |
|
3.
|
Page up until “Sun requirements” appears in the list and select it. |
|
5.
|
Select EQ in the Compare field. |
|
6.
|
With your cursor in the Value field, select Field functions > List selections. |
|
7.
|
Press Tab to display the list of temporary fields. |
|
8.
|
Select SUNREQ and press Enter. |
|
9.
|
Now press the Display report shortcut to generate your report. See figure 4. The question is displayed in a dialog, with the help message at the bottom of the window on the information line. |
|
10.
|
Type “FULL” and then press Enter to see the report. (See figure 5.) |
Redisplay the report, changing your answer to the prompt, and notice how the data changes. You can use this same technique for starting and ending dates, customer categories, dollar amounts, or anything else the user can enter.
|
11.
|
When you’re done viewing the report, press the Exit shortcut and select Operations > Save report. |
Summary
Go to Exercise four: Reading multiple files.