Placing a related nested report in another report

Typically, a related nested report provides the details for a master report. For example, a master report might provide information about customers. A related nested report placed in the master report could provide information about all the orders that belong to each customer.

StepsTo place a related nested report in another report:

  1. Create the nested report (DataWindow object) that you plan to place in the base report.

  2. Define a retrieval argument for the nested report.

    For example, suppose the nested report lists orders and you want to list orders for a particular customer. To define a retrieval argument, you would:

  3. Specify the retrieval argument in a WHERE clause for the SELECT statement.

  4. Open or create the report you want to have as the base report.

    In the example, the base report is one that lists customers and has a place for the order history of each customer:

    The Design View sample shows a header band for the Customers and Orders report that includes the text Customer Information on the left as the title of the base report and a box around the words Order History on the right. In the Detail band, labels and columns display on the left for all the data that belongs to the base report. The area on the right is blank.
  5. Select Insert>Control>Report from the menu bar.

  6. In the Design view, click where you want to place the report.

    The Select Report dialog box displays, listing defined reports (DataWindow objects) in the current project’s library search path.

  7. Select the report you want, and click OK.

    A box representing the report displays in the Design view.

  8. With the report still selected, 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 be used to supply the values of arguments 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.
  9. 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.

  10. Select File>Save from the menu bar.

  11. In the Preview view, you can see what your report looks like:

    The sample report is titled Customers and Orders. At left is an area titled Customer Information that displays the customer I D, name, address, and phone information for a single customer. At right is a nested report called Order History that includes six columns of information for four order the customer has placed, listed by Sales Order I D.