Using the Param Sheet

The Param sheet of the Catalog of Available Fields dialog enables you to create report parameters.

The following image shows the Param sheet with parameters that have previously been created.

The exchange rate parameter is a good example of a report parameter, as it is easy to see why you would want to be able to apply a rate that changes periodically. If your report publishes currency amounts, you may be called upon to publish those amounts in various currencies. In this example, there is one conversion rate only, to keep the concept simple.

After creating your parameter, you need to apply it. You can add a parameter as a simple field and apply parameters in report selection criteria or in scripts.

You can treat a parameter like any other report field and drag and drop it into a design layout for printing and display. In the case of an exchange rate parameter, you might want to publish the exchange rate the report is based on, along with the other data.

You can create selection criteria from the Profile Properties dialog. Typically, you create selection criteria to refine a report; for example, your selection criterion could be that you want records only for customers named Smith. However, by using a parameter as a selection criterion, you can apply a run time criterion. For details about creating selection criteria, see "Using the Selection Criteria Sheet", under "Creating or Maintaining Profiles", earlier in this chapter.

Scripts provide a more programmatic capability for applying parameters. In the case of the exchange rate, you would typically apply it to a database field; for example, an item price or to a summary total that is accumulated in the report.

The following image shows a footer section of a report design in which a United States (US) dollar amount (that is, the value on the farthest right) is printed along with total sales value (the underlined value). The US dollar amount is a script field called in $US, and the script on which it is based is shown in the following image. The script code is a simple multiplication of report total by the exchange rate parameter.

When you run the report, set the value of your parameter (in this example, the exchange rate parameter) by using the Report Parameters dialog. To summarize, the steps for creating, applying, and setting a parameter are listed in the following table.

Step Action For details, see…
1. Create a parameter "Creating a Parameter", later in this section.
2. Apply the parameter to a report field "Using the Script Sheet", later in this chapter.
3. Set the parameter value before running the report "Using the Parameters Sheet" under "Setting Report Properties", earlier in this chapter.

Perform step 3 in the preceding table each time you run the report with a changed parameter value.