How to Print Reports with Subreports
Languages: |
ContentsTemplateThis sub-template doesn't display properly when not included. Please see Template:Languages for the complete version. UsageThis template is designed to simplify Template:Languages, by allowing a simpler syntax for adding new languages. Each language is included by calling this template with the following parameters:
This template should not be used anywhere except in the Languages template. </noinclude> | Translate this article... |
Objective
The objective of this article is to show how to print reports that include subreports.
Execution Steps
There are three possible ways to print reports that include subreports:
- Using the $P{SUBREP_report_name} parameter to automatically look for the subreport that will be shown. This option only works on reports that have been processed by using the "Print" button in the Sales/Purchase Invoice, Sales/Purchase Order, Goods Receipt/Shipment and Payment In/Out windows. In those cases it is not necessary to include the subreport's .jasper since the .jrxml suffices, because at the time of execution it is being compiled and passed to the main report as a parameter.
- The next possibility is defining the .jrxml for a process (in the "Report and Process" window) and then include this process in the menu. In this case, the only possible option is using the precompiled subreport (jasper) and refering to it from the .jrxml using BASE_DESIGN followed by the jasper path. The main disadvantage of using a precompiled subreports in that it is not translated in runtime so that is only possible to have the subreport in one language.
- The last possibility is calling renderJR from an own java servlet, compiling the .jrxml and passing it as a parameter like described in the first method. This is done in the PrintController class (PrintController.java).