Parameter Linkage Among Drop-down Boxes by SQL Statements

  • Last update:June 05, 2025
  • Overview

    Version

    Report Server Version
    Functional Change

    11.0

    /

    Expected Effect

    When multiple parameter drop-down boxes exist in a template, the options of the latter drop-down boxes need to change accordingly with the parameter value of the former drop-down box. After you select the values in the former drop-down boxes, the options of the latter drop-down boxes are displayed according to the selected values in the former drop-down box. Hierarchical relationships exist among the options of drop-down boxes, enabling multi-level linkage.

    For example, the options of the drop-down box product_type need to change with the selected value in the drop-down box region, while the options of the drop-down box product need to change with the selected values in the drop-down boxes of region and product_type.

    动图1(新).gif

    Implementation Method

    You can realize the data linkage by the SQL functions. The datasets added are used as data dictionaries for each parameter box. The datasets for the latter parameter boxes can reference the former parameters for filtering.

    Procedure

    Data Preparation

    Create a general report and create a dataset ds1 with the SQL statement SELECT * FROM Sales_Volume where Region = '${region}' and Product_Types = '${product_type}' and Product = '${product}', as shown in the following figure.

    1.png

    Table Design

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

    2.png

    Adding Parameter Widgets

    Click the icon to edit the parameter panel, click Add All in the upper part of the right Component Setting area to generate parameter widgets, click the parameter boxes region, product_type, and product, and select Drop-down Box Widget, respectively, as shown in the following figure.

    3.png

    Adding Datasets for Options of the Parameter Boxes

    Region Option

    Create a dataset Region Option with the SQL statement SELECT distinct Region FROM Sales_Volume, as shown in the following figure. Since region is the first parameter without any filtering for linkage, you can specify the option range of the parameter as required. In this case, the keyword distinct is used to remove duplicate values.

    4.png

    Product Type Option

    Create a dataset Product Type Option with the SQL statement select distinct Product_Types from Sales_volume where Region = '${region}', as shown in the following figure. Since the values of Product Type need to be displayed based on the selected value of Region, you need to set region as a filter parameter.

    5.png

    Product Option

    Create a dataset Product Option with the SQL statement SELECT Product FROM Sales_Volume where Region = '${region}' and Product_Types = '${product_type}', as shown in the following figure. Since the values of Product are displayed based on the values of Product Type and Region, you need to set the region and product_type as filter parameters here.

    6.png

    Setting Data Dictionaries for Parameter Widgets

    1. Select the drop-down box widget region. Widget Name is set to region. In the Data Dictionary setting box, set Type to Data Query, select Region as Dataset, and set Display Value and Actual Value to Region, respectively, as shown in the following figure.

    7.png

    2. Select the drop-down box widget product_type. Widget Name is set to product_type. In the Data Dictionary setting box, set Type to Data Query, select Product Type as Dataset, set Display Value and Actual Value to Product_types, respectively, as shown in the following figure.

    8.png

    3. Select the drop-down box widget productWidget Name is set to product. In the Data Dictionary setting box, set Type to Data Query, select Product as Dataset, set Display Value and Actual Value to Product, respectively, as shown in the following figure.

    9.png

    Effect Display

    PC

    Save the template and click Pagination Preview, as shown in the following figure.

    动图1(新) - Copy.gif

    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 Parameter Linkage in Drop-down Box Widgets.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