Drop-down box implements data dictionary linkage

  • Last update:  2021-10-21
  • I. Overview

    1) Expected effect

    When making a parameter interface, it is hoped that the data of the drop-down widget is dynamic, as shown in the following figure. After the front widget selects a region, the drop-down box widget behind it will display the data of the region. If the front widget selects a city, the next drop - down box shows the data for the city. How to achieve this?

    gif1.gif


    2) Implementation roadmap

    By setting two parameters, set the value of the parameter to the formula, judge the value of the first parameter through the if condition in the formula, and finally extract the corresponding data column through the sql function.

    II. Steps

    1. Adding template parameters

    Create a general report, click "Template >Template Parameters", and add template parameters p1 and p2, as shown below:

    1.jpg


    2. Adding drop-down box widgets

    Enter the parameters panel, click"Add All" button on the right to add the drop-down box widget, as shown below:

    2.jpg


    3. Setting drop-down box widgets

    1) Setting the p1 drop-down box widget

    Select the P1 drop-down box widget and select "Custom" for data dictionary type setting. The actual value is the same as the displayed value, which is "Region" and "City" respectively, as shown in the following figure:

    3.jpg

    2) Setting the p2 drop-down box widget

    Select the P2 drop-down box widget, set the data dictionary type to "Formula", and enter the formula for the actual value:

    if($p1='City',sql("FRDemoEN","select City from Client",1),if($p1='Region',sql("FRDemoEN","select 
    Region from Client",1),""))

    4.jpg

    For details about the SQL functions used in the formula, see SQL functions


    4. Effect viewing

    1) PC

    Save the template and click the Pagination Preview to see what it looks like in Section of this article.

    2) Mobile

    The end effect of App and HTML5 is as follows:

    gif2.gif

    III. Download the template

    For the completed template, see: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc\Parameter\Drop-down_box_implements_data_dictionary_linkage.cpt

    Click to download the  template: 

    Drop-down_box_implements_data_dictionary_linkage.cpt



    Attachment List


    Theme: Parameter
    Already the First
    • 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