Irregular organization tree

  • Last update:  2021-12-31
  • I. Description

    In practical applications, in addition to the standardized organizational structure, there are also non-standard organizational structures. The following figure uses two examples to show the difference between these two organization trees:

    1) Standard organizational structure: Except for the last layer, all other layers have sub-layers. For example, the data of the company departmenttable in FRDemo with its own data connection;

    2) Irregular organizational structure: some hierarchical structures have sub-layers under them, and some hierarchical structures have no sub-layers under them, that is, the hierarchical structure is uncertain. For example, a company’s corporate structure includes headquarters, human resources, marketing, etc. Under the human resources department, there is also a human resources department, and a human resources department. The specific employees are under the human resources department, and the specific employees are directly under the marketing department. .

    Figure 1: Standardized organizational structure

    1.png

    Figure 2: Irregular organizational structure

    2.png

    Use an irregular organization structure to construct an organization tree report. If it is still implemented by the Organization tree sample, the situation shown in the figure above will appear, that is, the sub-layers of the hierarchy without sub-layer data will be blank.

    So how to make the level data without sub-level data merge and display all the level cells below it? The effect as shown below:

    3.png

    II. Ideas

    To realize that the level data without sub-level data is merged to display all the level cells below it, the level cell of the structure without sub-level data is merged downward (horizontal expansion downwards, vertical expansion to the right) to the last layer; Drag the data column of this level to make the cell expand all the data of the corresponding level; add filter conditions at the same time, if it has sub-layers, the data will be filtered out, displayed as blank, and then the blank row or column will be hidden. Taking the horizontal organization tree as an example, if the organization structure has three layers, the specific thinking steps are as follows:

    1) Realize the standard organization tree: design three rows according to the standard organization structure, and realize that the three rows represent three layers respectively; hide the columns without sub-layers through conditional attributes;

    2) Merge cells: adding a second column means that the second layer has no sub-layers. The cells in the second and third rows of the second column are merged, and the merged cells are dragged into the corresponding second layer; the left cell is used as the cell The upper parent cell of the cell; the first column and the second column of the upper cell are merged;

    3) Conditional attributes: After merging the cells, all the second layers are obtained. You need to add conditional attributes to the merged cells in the second column, and only display the second layer without sublayers.

    III. Example

    1. Data preparation

    Create a new built-in dataset ds1, one of the second-level structures in the built-in data set has no sub-layers. As shown below:

    4.png


    2. Making a template to implement a standardized organization tree

    Since the data prepared above is an irregular organization structure, we implement the organization tree according to the method in the Organization tree sample, that is, without using the tree data set, the template effect is as shown in the figure below:

    5.png

    A1, A2 and A3 are all horizontally expanded, and the cell settings are as follows:

    Cell

    Filter condition

    Shape setting

    A1parentnode==NULLActual Value:id    Display Value:name  
    A2parentnode==A1Actual Value:id    Display Value:name
    A3parentnode==A2Actual Value:id    Display Value:name

    Note: When adding a filter condition, you need to remove the check before the parent grid as the filter condition, as shown in the figure below for the filter condition of cell A2:

    6.png

    Please refer to the Data Dictionary for details on cell shape settings.

    Save the template at this time, and you can see the effect as shown in the figure below. The hierarchical structure without sub-layers does not merge cells, and the sub-layer cells are still there, but no data is displayed:

    7.png

    Note: If you use the tree dataset, please refer to Organization tree by tree dataset

    Hide columns without sub-layers through Conditional Formatting: use conditional formattingISNULL($$$) for A2 and A3, as shown in the figure below:

    8.png

    The effect is as follows:

    9.png

    3. Merge cells

    It can be seen from the renderings that the hierarchical structure without the lower layer is hidden by the conditions, and columns need to be added to display, and the layer is merged with the cells of the lower layer.

    Since FineReport does not support automatic merging of cells, it can only be merged manually. The cells of the second layer of data are in the second row, and the last layer is in the third row.

    So add column B, merge the cells behind A2 to the third row, that is, merge cells B2 and B3, drag the ID column to expand horizontally; set the upper parent cell A2, and filter only the second level structure; set its shape It is: the actual value is the name field of ds1; cell A1 is the first layer of data, so it needs to be displayed on all the data, and cells A1 and B1 need to be merged. The result is as follows:

    10.png

    The new cell settings are as follows:

    Cell

    Expansion Direction

    Shape setting

    B2Horizontal expansionActual Value:id    Display Value:name 

    The preview effect is as follows (each second layer is followed by a merged cell, and the corresponding level data is displayed):


    4. Conditional formatting

    In the above renderings, the added column shows all the second layers, and the ones with sub-layers are also displayed. By setting the condition attribute to the B2 cell, the columns with sub-layers will be hidden, REVERSE(ISNULL(A3)):

    12.png

    The effect is as follows:

    13.png

    5. Other settings

    The effect achieved in the above figure is the table header, and then drag the data corresponding to the list header (untis data column) to the fourth row cell, as shown in the following figure:

    14.png

    6. More levels of organizational structure

    If the organizational structure has 4 layers, then the template style is as shown in the figure below. More layers of organizational structure, similar to the design and implementation.

    15.png

    IV. Effect preview

    1. Preview on PC

    16.png

    2. Mobile 

    1) App

    微信图片_20211231182414.jpg

    2) H5

    微信图片_20211231182410.jpg

    V. Completed template

    To view the effect of the template online, please click Irregular Organization Tree Report.cpt

    For the completed template, please refer to %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\

    BasicApplication\Irregular organization tree.cpt

    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