Returning Display Values in a Drop-down Tree in a Cell

  • Last update:May 14, 2025
  • Overview

    Problem

    If a drop-down tree widget in a cell is configured with both actual and display values in the data dictionary, the display values are displayed during selection, and actual values are displayed in the cell when the drop-down tree widget is in the blur state.

    For example, the drop-down tree in the following figure is used to display the department structure. The values in the drop-down tree are changed from the display values, namely department names, to the actual values of options, namely department IDs, when the drop-down tree widget is in the blur state.

    How to display the display values in a drop-down tree when the drop-down tree widget is in the blur state, and submit the display values to the database?

    动图1.gif

    Cause

    The drop-down tree returns an array. However, if the full hierarchical path is returned, the full hierarchical path of each node will be regarded as a single string to match data when actual values are converted to display values. Consequently, the corresponding display values cannot be matched.

    Implementation Method

    You can select Data Dictionary in Display, and set Actual Value and Display Value. In this case, the display values are finally displayed when the drop-down tree widget is in the blur state. You can use the MAPARRAY() and VALUE() functions to convert actual values to display values and submit the display values to the database.

    Example

    Data Preparation

    1. Create a general report and add a database query dataset ds1 with the SQL statement SELECT * FROM CorporationDepartment.

    2. Add a tree dataset Tree1 and select ds1 mentioned above, as shown in the following figure.

    Drop-down Tree Adding

    Add a Drop-down Tree widget to cell A1, set Tree Creation to Automatic Creation, set Actual Value to DepartmentID, and set Display Value to Department_name. Select Multiselect and deselect Return Full Hierarchical Path. The following figure shows the effect.

    Cell Display Setting

    Select cell A1, choose Cell Attribute > Display, select Data Dictionary, set Dataset to ds1, set Actual Value to DepartmentID, and set Display Value to Department_name.

    Data Entry Attribute Setting

    Through the above settings, the display values are displayed when the drop-down tree widget is in the blur state. But the data to be submitted to the database now is still the values obtained by the cell, namely the actual values. In this case, you can use the formula maparray(A1,value("ds1",3,1,item)) where the maparray function is used to create an array and the value function is used to populate this array with department names corresponding to each department ID in cell A1.

    If you need to concatenate the values in the result and store the result as a string in the database, you can add a string concatenation function JOINARRAY. The formula is JOINARRAY(maparray(A1,value('ds1',3,1,item)),',').

    Effect Display

    The following figure shows the preview effect on PC.

    动图2.gif

    iconNote:
    The solution also supports mobile preview.

    Template Download

    For details, you can download the template Returning Display Values in a Drop-down Tree.cpt.

    Attachment List


    Theme: Data Entry
    • 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