Selecting the First Values by Default During Drop-Down Box Linkage

  • Last update:June 06, 2025
  • Overview

    Version

    Report Server VersionFunctional Change

    11.0

    /

    11.0.18

    Added SQL writing methods in an anti-injection way to SQL functions.

    Expected Effect

    Through the drop-down box parameter linkage by SQL statement, you can realize the linkage of the drop-down lists of drop-down box parameters. You need to enable the drop-down boxes to select the first values of the drop-down lists by default in use, as shown in the following figure.

    动图1.gif

    Implementation Method

    To realize the desired effect, you can modify the display content by assigning values to the widget values on the parameter panel, and use SQL functions to query the corresponding first values in the database of the parameters mentioned before.

    Example

    Setting the Customer ID Drop-down Box Widget

    Select the Customer ID drop-down box widget, set Widget Value to Formula, and enter sql("FRDemoEN","SELECT CUSTOMERID FROM ORDERS ",1,1), as shown in the following figure. In this case, the first customer ID of the CUSTOMERID field is displayed by default during the report preview.

    1.png

    Setting the EMP ID Drop-Down Box Widget

    Select the EMP ID drop-down box widget. Similarly, set Widget Value to Formula, and enter if(len($Customer)=0,'',sql("FRDemoEN","SELECT EMPID FROM ORDERS where CUSTOMERID = '"+$Customer+"'",1,1)), as shown in the following figure.

    iconNote: 
    Values queried by the SQL statements that assign values to widget values must be consistent with the corresponding values queried in the data dictionaries. Otherwise, the results may be incorrect.

    2.png

    Setting the Shipping Method Drop-down Box Widget

    Select the Shipping Method drop-down box widget. Similarly, set Widget Value to Formula, and enter if(len($Customer)=0||len($EMP)=0,"",sql("FRDemoEN","SELECT SHIPMETHOD FROM ORDERS where CUSTOMERID = '"+$Customer+"' and EMPID = '"+$EMP+"'",1,1)).

    iconNote:
    Values queried by the SQL statements that assign values to widget values must be consistent with the corresponding values queried in the data dictionaries. Otherwise, the results may be incorrect.

    3.png

    Effect Display

    PC

    The effect is the same as that shown in section "Expected Effect."

    Mobile Terminal

    The preview effects on the DataAnalyst app and the HTML5 terminal are the same, as shown in the following figure.

    动图2.gif

    Template Download

    For details, you can download the template Selecting the First Values by Default During Drop-down Box Linkage.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