Setting up parameter links
If a subreport contains parameters, the values must be supplied at runtime. You can map the subreport parameters to DBFields, formulas or parameters which are contained in the dataset of the component where the subreport is inserted in the primary report, and are of the same data types as the subreport parameters.
The following example shows how to set up parameter links between a primary report and a subreport.
Assume that you have two reports in the same catalog: Report A (with Report Tab A in it) and Report B (with Report Tab B in it). Report Tab B has a parameter PToday (Date type). Then, you insert Report Tab B as subreport into Report Tab A. When you view Report Tab A, you will be prompted to enter value for its subreport parameter PToday. However, you do not want to enter the value each time you run Report Tab A and instead want to give it a fixed value. To achieve this, follow the steps below:
- Right-click the inserted subreport in Report Tab A and select Format Subreport.
- In the Subreport dialog, click the Parameters tab (this tab is disabled if the subreport does not contain any parameters).
- In the Parameters column, you can see PToday is listed there and a same parameter is assigned to it by default in the Value column.
- Click the value drop-down list where all the DBFields, formulas and parameters of Data type in the dataset of Report Tab A are listed. Here, we select MYTODAY which is a predefined formula and returns a value ToDate(2006,01,01).
- Click OK to apply the settings.
- View Report Tab A, and no parameter dialog will be displayed prompting you to enter the value since the formula value is passed to PToday.
Notes:
- If a subreport parameter is mapped to another parameter, you will still be prompted to input the value at runtime. In the Enter Parameter Values dialog, the parameter name you see is that of the mapping parameter.
- If a subreport parameter is mapped to a formula, the parameter will obtain value automatically from the mapping formula.