#### Returning values to the primary report

You can make values of the subreport return to the primary report. To do this:

1. Right-click the subreport and select Format Subreport from the shortcut menu.
2. In the Subreport dialog, click the Return Value tab.
3. In the Component in Report box, check the component in the subreport, the fields of which you want to use to return value to parameters of the primary report, then the Field in Subreport box will list all available fields used by the selected component.
4. Select the field that you want to assign to a parameter in the primary report, click , and a parameter in the primary report of the same data type will be displayed in the Parameters column of the Return Value box. If the automatically assigned parameter is not what you need, select the required one from the parameter drop-down list. See illustration.

5. If required, select another component in the Component in Report box and set more mapping fields for parameters in the primary report.
6. When done, click OK to apply the settings.

Notes:

- When passing values between the subreport and the primary report, you should pay attention to avoiding parameter loop, which may occur as this case: parameter A of the primary report is assigned to parameter B of the subreport in the Parameters tab, while in the Return Value tab, B is assigned to A. In this case, the values of A and B will depend on the default values and the position relationship between the two parameters.
- When you insert the subreport, you should insert it before the parameter, or the parameter will not be the expected value.
- To use the return value parameter in a formula, you need to add pagenumber in the first line in the formula.

  For example, all the formulas which referenced the return value parameter should be like:

  pagenumber;
  ... ... ...
  ... ... ...

- If the subreport will cross page, the result of the formula may not be the expected value because the return value will only be calculated when finishing laying out the subreport.