PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Creating a nested report
  • Principle
  • Example 1: Simple nested reports
  • Example to perform
  • Operations to perform
  • Example 2: Nested reports with different orientations (Landscape/Portrait)
  • Example to perform
  • Operations to perform
  • Specific features of secondary reports
  • Blocks in the secondary report
  • Orientation of secondary report
  • Page break in the secondary report
  • Secondary report based on a query with parameters
  • Secondary report based on a query that is using a specific connection
  • Secondary report printed from a Page Footer block
  • Displaying the total number of pages in the secondary report
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Creating a nested report

Principle

The creation of a main report containing several secondary reports is performed in several steps:
  1. Creating a main report.
  2. Creating the secondary reports. The orientation of these reports can differ from the orientation of main report.
  3. Printing secondary reports in the main report with iPrintReport. This function must be used:
    • in the "Before printing" process of a block: the secondary report will be printed before this block.
    • in the "After printing" process of a block: the secondary report will be printed after this block.
      Caution: If the nested reports have different orientations, iParameter must be called in order to change the print orientation accordingly.
  4. Configuring the print of page headers and footers for the nested report (iNestedHeaderFooter). This function can be used:
    • in the opening code of main report: it will be taken into account by all the nested reports that will be printed from the main report.
    • before printing the nested report: it will be taken into account by the following nested report.
  5. Printing the main report. See Printing a main report that includes several secondary reports for more details.
Versions 17 and later
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.
New in version 17
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.
Example 1: Simple nested reports

Example to perform

The "RPT_Orders" report is based on the "Orders" data file. This report is used to print the characteristics of each order (date, customer number, total amount, ...). A break on the "OrderNum" item is used to separate the different orders.
The "QRY_ProductOrdered" query selects all the products of a specified order. This query expects an order number in parameter.
The "RPT_ProductOrdered" report is based on the "QRY_ProductOrdered" query. This report only prints the products selected by the "QRY_ProductOrdered" query.
The "RPT_ProductOrdered" report corresponds to the secondary report. This report will be printed after each break.

Operations to perform

  1. Create the "RPT_Orders" report ("File .. New .. Report"). This report corresponds to the main report.Create the "RPT_Orders" report: this report corresponds to the main report.
    • Click New among the quick access buttons.
    • Click "Report" in the wheel that is displayed. The window for creating a new element is displayed: click "Report" then "Report".
  2. Create the "QRY_ProductOrdered" query. See Creating a query with parameters for more details.
  3. Create the "RPT_ProductOrdered" report ("File .. New .. Report"). This report corresponds to the secondary report.
    Note: The Page footer block of this report will not be printed. See Blocks in the secondary report for more details.
    Create the "RPT_ProductOrdered" report: this report corresponds to the secondary report.
    • Click New among the quick access buttons.
    • Click "Report" in the wheel that is displayed. The window for creating a new element is displayed: click "Report" then "Report".
      Note: The Page footer block of this report will not be printed. See Blocks in the secondary report for more details.Note: The Page footer block of this report will not be printed. See Blocks in the secondary report for more details.
  4. In the "Post-print" process of the Break footer block of the "RPT_Orders" report, enter the following code:In the "After printing" process of the Break footer block of the "RPT_Order" report, enter the following code:
    // Initialize the query and
    // pass in parameter the number of the order currently printed
    iInitReportQuery(RPT_ProductOrdered, MySource.OrderNum)
    // Print the nested report
    iPrintReport(RPT_ProductOrdered)
Example 2: Nested reports with different orientations (Landscape/Portrait)

Example to perform

The main report ("RPT_LANDSCAPE") is printed in landscape mode. A sub-report ("RPT_PORTRAIT") in portrait mode must be called for each printed element. The secondary report must be started (by changing the orientation) in the "Post-print" code of the body block of the main report. Then, the secondary report must restore the orientation of the main report at the end of print.

Operations to perform

  1. Create the "RPT_LANDSCAPE" report ("File .. New .. Report") and choose an orientation in landscape mode. This report corresponds to the main report.
    Note: This report can be any type of report that is using data coming from any source: file, query, table, programming, ...
    Create the "RPT_LANDSCAPE" report: this report corresponds to the main report.
    • Click New among the quick access buttons.
    • Click "Report" in the wheel that is displayed. The window for creating a new element is displayed: click "Report" then "Report".
    • Choose an orientation in landscape mode.
      Note: This report can be any type of report that is using data coming from any source: file, query, table, programming, ...
  2. In the description of the main report, in the "Options" tab, check "Print the report as is".
  3. In the "Format" tab, specify the margins and the indent. Validate the description window of the report.
  4. Create the "RPT_PORTRAIT" report ("File .. New .. Report") and choose an orientation in portrait mode. This report corresponds to the secondary report.
    Note: This report can be any type of report that is using data coming from any source: file, query, table, programming, ...
    Create the "RPT_PORTRAIT" report: this report corresponds to the secondary report.
    • Click New among the quick access buttons.
    • Click "Report" in the wheel that is displayed. The window for creating a new element is displayed: click "Report" then "Report".
    • Choose an orientation in portrait mode.
      Note: This report can be any type of report that is using data coming from any source: file, query, table, programming, ...
  5. In the description of the secondary report, in the "Options" tab, check "Print the report as is".
  6. In the "Format" tab, specify the same margins and the same indent as the ones specified for the main report. Validate the description window of the report.
  7. In the "After printing" process of the PAGE FOOTER block of the "RPT_LANDSCAPE" report (main report), enter the following code:
    // Call to the report with a different orientation (portrait mode here)
    iPrintReport(RPT_PORTRAIT)
    // Note: If this secondary report includes a page footer, this page footer will not be printed
Specific features of secondary reports

Blocks in the secondary report

By default, when printing a secondary report (with iPrintReport), all the blocks found in the secondary report are printed except for the following blocks:
  • the Page header block.
  • the Page footer block.
To force these blocks to be printed, use iNestedHeaderFooter.
Note: If the secondary report contains a table whose header is found in the Page header block, only the Page footer block will not be printed (all the other blocks will be printed). In this case, the Page header block will be printed before the first row of the table (found in the secondary report).
By default, when printing a secondary report (with iPrintReport), all the blocks found in the secondary report are printed except for the following blocks:
  • the Page header block.
  • the Page footer block.
To force these blocks to be printed, use iNestedHeaderFooter.
Note: If the secondary report contains a table whose header is found in the Page header block, only the Page footer block will not be printed (all the other blocks will be printed). In this case, the Page header block will be printed before the first row of the table (found in the secondary report).

Orientation of secondary report

The secondary report and the main report can have different orientations. In this case, iParameter must be called to modify the print orientation accordingly.
Versions 17 and later
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.
New in version 17
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.
Note: To print reports with different orientations (portrait/landscape), we recommend that you use the sequencing of reports. This method can be easily implemented. See Sequencing reports for more details.

Page break in the secondary report

The page breaks defined in a secondary report will be taken into account when printing the main report.

Secondary report based on a query with parameters

If the secondary report is based on a query with parameters, use iInitReportQuery to pass parameters to the query. This function must be used before iPrintReport.

Secondary report based on a query that is using a specific connection

If the secondary report is based on a query that handles a specific connection, use iInitReportQueryConnection to run this query (and to pass parameters if necessary). This function must be called before iPrintReport.

Secondary report printed from a Page Footer block

If the secondary report is printed from a Page Footer block, its Page Footer blocks will not be printed.

Displaying the total number of pages in the secondary report

A page counter must be added into the main report in order for the pages counter to operate in the nested report. However, the counter found in the main report can be made invisible if necessary.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment