Supplying retrieval arguments to relate a nested report to its base report

The most efficient way to relate a nested report to its base report is to use retrieval arguments. If your nested report has arguments defined, you use the procedure described in this section to supply the retrieval argument value from the base report to the nested report. (The procedure described is part of the whole process covered in “Placing a related nested report in another report”.)

Why retrieval arguments are efficient

Some DBMSs have the ability to bind input variables in the WHERE clause of the SELECT statement. When you use retrieval arguments, a DBMS with this capability sets up placeholders in the WHERE clause and compiles the SELECT statement once. PowerBuilder retains this compiled form of the SELECT statement for use in subsequent retrieval requests.

Requirements for reusing the compiled SELECT statement

To enable PowerBuilder to retain and reuse the compiled SELECT statement:

NoteNested reports in composite reports If the base report is a composite report, you need to define retrieval arguments for the composite report before you can supply them to the nested report.

In the Properties view for the composite report, select the General page. Then define the retrieval arguments that the nested report needs, taking care to specify the correct type.

StepsTo supply a retrieval argument value from the base report to the nested report:

  1. Make sure that the nested report has been set up to take one or more retrieval arguments.

    See “Placing a nested report in another report”.

  2. Select the nested report and then select the General page of the Properties view.

    The Arguments box lists arguments defined for the nested report and provides a way for you to specify how information from the base report will supply the value of the argument to the nested report.

    The sample displays the General page of the Properties view superimposed on the right side of the report. Highlighted is the Arguments box at the bottom. It displays the column headings Name, Type, and Express dot dot dot. Under the headings is an argument numbered one with the Name customer i d, of Type Number, and an empty expression field, which has focus. At the bottom of the Arguments box is a button labeled Clear Arguments.
  3. Supply the base report column that will supply the argument’s value. To do this, click the button in the Expression column.

    The Modify Expression dialog box displays. In this dialog box, you can easily select one of the columns or develop an expression. In the example, the column named id from the base report will supply the value for the argument :customerid in the nested report.

    When you run the report now, you are not prompted for retrieval argument values for the nested report. The base report supplies the retrieval argument values automatically.