Master-sub embedded report

  • Last update:  2022-02-07
  • I. Overview

    The feature of embedded master-sub report is to embed independent report template in cells. The embedded template is called "sub report", and the whole embedded sub report is called "master report".

    The format of each sub report can be out of alignment, and the format of the sub table and the master table can also be out of alignment. The sub report can obtain the values in the master table. As shown in the figure below, the list of employee sales is as follows:

    7.png

    II. Examples

    1. Making master report

    1) design form

    Create a new normal report and design the master table as shown in the figure below:

    截屏2021-01-22 上午9.49.55.png

    Note: adjust the line height according to the actual situation, otherwise only part of the data can be displayed.

    2) Adding parameters

    Click template > template parameters to add a parameter to the master table, double-click the parameter name to modify it to orderID, and query the order information and order details of an OrderID through the parameter.

    截屏2021-01-22 上午9.38.34.png

    3) add drop-down box widget

    Click the edit parameter interface, click "add all", and generate components on the parameter pane. The parameter widget selects the drop-down box and finally adjusts the location of the component.

    截屏2021-01-22 上午9.39.12.png

    4) Setting widget default value

    Select the "drop-down box widget", change the name to "OrderID", and the widget value defaults to the string "10008", that is, query 10008's information by default.

    截屏2021-01-22 上午9.55.59.png

    Click data dictionary settings and select the orders table in FRDemo database. The actual value and display value are both orderID. 

    截屏2021-01-22 上午9.54.27.png


    2. Making subreport 1

    1) Data preparation

    Create a new normal report, create a new database query DS1, and the SQL query statement is: select * from ORDERS

    where OrderID = ${OrderID}

    The order information of the corresponding orderID can be found through the parameter ID.


    2) Design form

    The design table is as follows:

    截屏2021-01-22 上午10.02.03.png

    Save the report when finished.


    3. Making subreport 2

    1) Data preparation

    Create a new normal report, create a new database query DS1, and the SQL query statement is: 

    select * from ordersdetail

    where OrderID = ${OrderID}

    Through the parameter "OrderID", the order details corresponding to the orderID can be found.

    2) Design form

    The design table is as follows:

    截屏2021-01-22 上午10.04.38.png

    Save the report when finished.


    4. Embedded subreport

    1) Open the master report, right-click cell B4 of the master report, and select cell element > insert sub report, as shown in the following figure:

    截屏2021-01-22 上午10.11.57.png

    2) In the pop-up Insert Sub Report dialog box, select the path of subreport 1. Add parameter OrderID (parameter name in sub report), whose value is formula $OrderID, as shown in the figure below:

    截屏2021-01-22 上午9.40.14.png

    3) Right click cell B7 of the master report and select cell element > insert subreport. In the pop-up insert sub report dialog box, select the path of subreport 2, as shown in the following figure:


    5. Effect preview

    Save the report and click page preview. The effect is as follows:

    2.gif

    Note: mobile terminal does not support.

    III. Template download

    For completed templates, please refer to:

    Main report:%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\Master.cpt

    Subreport 1:%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\Sub1.cpt

    Subreport 2:%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\Sub2.cpt

    Click to download the template:

    Master.cpt

    Sub1.cpt

    Sub2.cpt


    IV. Precautions

    1. Cell boundary between embedded sub report and main report

    1) Problem description

    When setting a border in the cell of a subreport embedded in the main report, the subreport cannot be aligned with the left border of the cell in the preview effect, as shown in the following figure:

    截屏2021-01-22 上午9.41.49.png


    2) Cause analysis

    Because the "cell attributes > style > alignment" of cells will automatically indent left and right by default, when previewing, the left boundary of the embedded sub report and the main report cells cannot be aligned. As shown in the figure below:

    3) Solutions

    Change the left and right indent of cell attributes > style > alignment to 0. The effect is as follows:

    Note: it is not supported to automatically fill the whole cell in sub report.


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy