Multi-value query for dataset parameters

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

    The FR designer can realize the multi-value query function of the dataset. Users can filter the multi-value query of the dataset according to the actual situation. There are two application scenarios for dataset multi-value queries.

    II. Scenario 1: Query multiple fields with multiple values

    Users perform multi-value query on multiple fields in the dataset to filter and display the data. For example, for multi-regional sales companies, it is often necessary to conduct joint queries for their respective regions, provinces and cities, as well as compare cities at the same level. As shown below:

    gif1.gif


    1. Preparing templates

    This paper will achieve the effect of scene 1 based on the Drop-down box parameter linkage.

    Template location: %FR_HOME%\webroot\WEB-INF\reportlets\doc\Parameter\cptMulti-value_query_for_dataset_parameters.cpt

    Alternatively, click to download the template:

    Multi-value_query_for_dataset_parameters..cpt

    Open the template in FineReport Designer as shown below:

    1.jpg


    2. Modifying a template dataset

    Modify template dataset ds1 to:

    SELECT * FROM Employe where Country= '${country}' and Region = '${region}' and City in ('${city}')

    As shown below:

    2.jpg


    3. Setting the drop-down check Box widget

    Enter the parameter panel and delete the drop-down widget named city, as shown below:

    3.jpg

    Add a drop-down check box widget named city, set the data dictionary to "Data Query", set the dataset to "City ", and set the actual value and display value to "City". Set the return value type to a string and the delimiter to ',' (that is, a comma is placed between single quotation marks (). The delimiter is set to separate multiple parameter values. For example, if the region is North China, Central China, the return value is North China, Central China).

    Note: Delimiter must be entered in English half corner state.

    4.jpg

    5.jpg


    4. Effect preview

    1) PC

    Save the template and click "Pagination Preview" to see the effect shown in Section I.

    2) Mobile 

    App and HTML5 end effect, as shown below:

    gif2.gif

    III. Scenario 2: Query multiple values for a single field

    Users can perform multi-value queries on a single field in a dataset using a drop-down check box widget.

    1. Data preparation

    Create a general report, create a dataset ds1, SQL statement is:SELECT * FROM Product where Product_name in ('${name}')

    Note: If the parameter is a string, be sure to add single quotation marks. For numerical values, single quotation marks are not required.

    6.jpg


    2. Report design

    Drag the field into the corresponding cell, as shown below:

    7.jpg


    3. Adding parameter widgets

    Edit the parameter panel, click "Add All" above the widget Settings on the right to generate the parameter widget, click the parameter box, and select "Drop-down Check Box widget".

    8.jpg


    4. Setting the data dictionary of the parameter widget

    Select the drop-down check box widget named name, set the data dictionary to the Database Table, select the product table of the built-in database FRDemoEN, the actual value and display value are the Product_name, select the return value type "String", set the delimiter to ", "(i.e., single quotation marks with a comma between them, The separator is set to separate the selected values. For example, if the product name is Apple juice, milk, the return value is apple juice, milk.

    Note: Delimiter must be entered in English half corner state.

    9.jpg


    5. Effect preview

    1) PC

    gif3.gif


    2) Mobile 

    App and HTML5 end effect, as shown below:

    gif4.gif


    IV. Download the template

    1) For the scenario 1 template, see:

    %FR_HOME%\webroot\WEB-INF\reportlets\doc\Parameter\cptMulti-value_query_for_dataset_parameters.cpt

    Clickto download the template: 

    Multi-value_query_for_dataset_parameters..cpt

    2) For scenario 2 templates, see:

    %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc\Parameter\MultiValue\Drop - down_check_box_multi-value_query.cpt

    Click to download the template: 

    Drop - down_check_box_multi-value_query.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