How To Calculate And Collect Sub-Report Values

This recipe demonstrates how to calculate amount from sub-report and show the result in main report.

Major steps include the following:

  1. Create a report template using the datasources (D1.ds and cmps-D2.ds).
  2. Add the “acctcode” field as “Data Field”.
  3. Add into “Details” the Sub-Report (sub-demo.rml).
  4. Add into “Group Footer” the following script:subtotal
    grandtotal += subtotal;
  5. Add into “Section Footer” the following script:grandtotal;

To download the necessary files for this recipe, refer to the attached ZIP package.
HowToCalculateCollectSub-ReportValues.zip (7.3 KB)