Pop-up Prompt Box for Layer Limit During Parameter Linkage by JS

  • Last update:June 19, 2025
  • Overview

    Expected Effect

    During parameter linkage, parameters with hierarchical relationships need to be set based on the hierarchical relationships. When your operation does not follow the hierarchical relationships, a pop-up prompt box needs to be displayed.

    For example, the following figure shows the effect. During data query, you need to select the values of parameters according to the order: the shipper's region and then the shipper's city. When you select the shipper's city directly, a prompt box is displayed, indicating that the operation is illegal.

    动图1.gif

    Implementation Method

    You can add a Before Editing event by JS for the child parameter widget. In this case, if the value of the parent parameter widget of the child parameter widget is empty, a prompt box is displayed, indicating that the operation is illegal.

    Example

    Data Preparation

    Create a dataset ds1 with the SQL statement Select * from Orders where "Shipper's region" ='${shipper_region}' and "Shipper's city"='${shipper_city}', as shown in the following figure.

    1.png

    Create a database query ds2 with the SQL statement Select "Shipper's region" from Orders, as shown in the following figure.

    2.png

    Create a database query ds3 with the SQL statement Select "Shipper's city" from Orders where "Shipper's region"='${shipper_region}', as shown in the following figure.

    3.png

    Table Design

    1. Design the table style and drag the corresponding fields into the table, as shown in the following figure.

    4.png

    2. Click Add All to add the shipper_region and shipper_city parameters to the parameter management panel, and select Drop-down Box Widget, respectively, as shown in the following figure.

    5.png

    3. Select the drop-down box widget shipper_region, click , and set Type to Data Query, set Dataset to ds2, set Actual Value and Display Value to Shipper's region, respectively, in the Data Dictionary setting box, as shown in the following figure.

    6.png

    4. Select the drop-down box widget shipper_city, click , and set Type to Data Query, set Dataset to ds3, set Actual Value and Display Value to Shipper's city, respectively, in the Data Dictionary setting box, as shown in the following figure.

    7.png

    Event Adding

    Select the drop-down box widget shipper_city, and add a Before Editing event by JS. The JS code is as follows:

    var a=_g().getParameterContainer().getWidgetByName('shipper_region').getValue();
    if(a.length<=0){
    FR.Msg.alert("Prompt","Please select the shipper's region first."+a);
    };

    Effect Display

    PC

    Save the report and click Pagination Preview. When you select a shipper's city from the drop-down box shipper_city, the prompt "Please select the shipper's region first." is displayed. When you select a shipper's region before selecting a shipper's city, the data is normally displayed, as shown in the following figure.

    动图2.gif

    Mobile Terminal

    The following figure shows the preview effect on the DataAnalyst app and the HTML5 terminal.

    动图3.gif

    Template Download

    For details, you can download the template Pop-up Prompt Box for Layer Limit During Parameter Linkage by JS.cpt.

    Attachment List


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