Using composite reports

When designing a DataWindow object for a report, you can choose to combine other reports (which are also DataWindow objects) within it. The basic steps for using composite reports in an application are the same ones you follow for the other report types. There are, however, some additional topics concerning these reports that you should know about.

To learn about designing composite reports, see the DataWindow Designer User's Guide.

Printing multiple updatable DataWindows on a page

An advantage of composite reports is that you can print multiple reports on a page. A limitation of composite reports is that they are not updatable, so you cannot directly print several updatable DataWindows on one page. However, there is an indirect way to do that, as follows.

You can use the GetChild method on a report embedded in a composite report to get a reference to that report. After getting the reference to the nested report, you can address it at runtime like other DataWindows.

Using this technique, you can call the ShareData method to share data between multiple updatable DataWindow controls and the nested reports in your composite report. This allows you to print multiple updatable DataWindows on a page through the composite report.

StepsTo print multiple DataWindows on a page using a composite DataWindow:

  1. Build a form that contains DataWindowControls with the updatable DataWindow objects.

  2. Define a composite report that has reports corresponding to each of the DataWindows in the window or form that you want to print. Be sure to name each of the nested reports in the composite report.

  3. Add the composite report to the form (it can be hidden).

  4. In your application, do the following:

    1. Retrieve data into the updatable DataWindow controls.

    2. Use GetChild to get a reference to the nested reports in the composite report.

    3. Use ShareData to share data between the updatable DataWindow objects and the nested reports.

    4. When appropriate, print the composite report.

      The report contains the information from the updatable DataWindow objects.

NoteRe-retrieving data Each time you retrieve data into the composite report, all references (handles) to nested reports become invalid, and data sharing with the nested reports is terminated. Therefore, be sure to call GetChild and ShareData each time after retrieving data.

For a list of properties of nested reports, see the DataWindow Object Reference.