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:
-
The database interface must
support binding of input variables. -
You must enable binding support by setting the DisableBind
database parameter to 0, which is the default. -
You must enable caching in the database profile.
Set the SQLCache database parameter
to the number of levels of nesting plus 5.For more information, see the description
of the SQLCache and DisableBind
database parameters in the online Help.
Nested 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.
To supply a retrieval argument value from the
base report to the nested report:
-
Make sure that the nested report has been
set up to take one or more retrieval arguments. -
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.
-
Supply the base report column or the expression
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.