Multi-Value Query from a Drop-down Checkbox by Dataset Parameters

  • Last update:December 06, 2024
  • Overview

    Version

    Report Server VersionFunctional Change
    11.0

    /

    Function Description

    FineReport allows you to perform a multi-value query on a dataset based on the actual scenario. The multi-value query on a dataset can be applied to two scenarios.

    Scenario One: Multi-Value Query on Multiple Fields

    You can perform the multi-value query on multiple fields in the dataset to filter and display data. For example, a multi-region sales company often needs to perform combined queries across regions, countries, and cities, as well as comparisons between cities at the same level.

    Screen Recording 2024-12-06 at 16.19.06 (2).gif

    Template Preparation

    This document introduces how to achieve the effect of scenario one using the following template.

    You can click to download the template:Drop-down Box Parameter Linkage.cpt.

    Open the template in FineReport, as shown in the following figure.

    2024-12-03_16-46-48.png

    Modifying the Template Dataset

    Change the SQL statement in dataset ds1 as SELECT * FROM Orders where "Shipper's region"='${area}' and "Shipper's country"='${country}' and "Shipper's city"='${city}', as shown in the following figure.

     2024-12-06_16-18-30.png

    Setting the Drop-Down Checkbox Widget

    Enter the parameter panel, and delete the drop-down box widget named city, as shown in the following figure.

    2024-12-03_16-49-36.png

    Add a drop-down checkbox widget, and name it city. On the Data Dictionary setting page, set Type to Data Query, Dataset to City Option, and both Actual Value and Display Value to Shipper's city. Set Returned Value's Type to String, and set Separator to ',' (a comma enclosed in single quotation marks). The separator is used to separate multiple selected parameter values. For example, if Lampang and Chumphon are selected from the drop-down list of City, the returned value will be Lampang','Chumphon.

    iconNote:
    The separator must be entered in the English half-width mode.

    2024-12-03_16-52-26.png

    Effect Display

    PC

    Save the template, and click Pagination Preview. The preview effect is the same as that in section "Scenario One: Multi-Value Query on Multiple Fields."

    Mobile Terminal

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

    ScreenRecording_12-06-2024 16-49-16_1 (1).gif

    Scenario Two: Multi-Value Query on a Single Field

    You can perform the multi-value query on a single field in the dataset through the drop-down checkbox widget.

    Data Preparation

    Create a general report. Create a dataset named ds1, and enter the SQL statement: SELECT * FROM SProduct where Product_name in ('${name}').

    iconNote:
    If the parameter is of string type, ensure that single quotation marks are added. If the parameter is of numeric type, single quotation marks are not needed.

    2024-12-06_15-47-08.png

    Report Design

    Drag the fields into the corresponding cells, as shown in the following figure.

    2024-12-06_15-48-32.png

    Adding the Parameter Widget

    Enter the parameter panel, and click Add All in the upper right corner of the designer.

    2024-12-06_16-11-49.png

    Set Widget Value of the label widget to Product Name:, click the parameter box of the parameter widget, and select the drop-down checkbox widget.

    2024-12-06_15-53-46.png

    Setting the Data Dictionary for the Parameter Widget

    Click the drop-down checkbox widget named name. On the Data Dictionary setting page, set Type to Database Table, Database to FRDemo, Database Table to SProduct, and both Actual Value and Display Value to Product_name. Set Returned Value's Type to String, and set Separator to ',' (a comma enclosed in single quotation marks). The separator is used to separate multiple selected parameter values. For example, if Apple Juice and Milk are selected from the drop-down list of Product Name, the returned value will be Apple Juice','Milk.

    iconNote:
    The separator must be entered in the English half-width mode.

    2024-12-06_15-55-44.png

    Effect Display

    PC

    Screen Recording 2024-12-06 at 15.57.21 (1).gif

    Mobile Terminal

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

    ScreenRecording_12-06-2024 16-05-42_1 (3).gif

    Template Download

    1. Template for scenario one:

    Click to download the template: Multi-Value Query by Dataset Parameters.cpt.

    2. Template for scenario two:

    Click to download the template: Multi-Value Query from a Drop-down Checkbox.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