Text Field Control Realizes Multi-value Query

  • Last update:  2021-03-02
  • I. Overview

    1.1 Expected effect

    How to set the filter condition of the report when the parameter value of the text field is multiple? As shown in the figure below, when the text field parameter has multiple order IDs, the query result is the information of multiple order IDs.

    1.png

    1.2 Implementation Ideas

    Use the filter function of the report to set filter conditions, or filter through SQL statements.

    II. Example-Filter Condition

    2.1 Design report

    1) New template, new data set ds1, SQL statement: 

    SELECT * FROM ORDERS

    2) Drag the field of the dataset ds1 into the report cell to design the table style. As shown below:

    2.png


    2.2 Add Text Area control

    In the parameter panel, add [Text Area] control and [Query] button, the name of the [Text Area] control is "AK", as shown in the following figure:

    3.png


    2.3 Add filter

    Set the filter condition in cell A2 and select the formula. The content of the formula is: INARRAY($$$, split($AK, "\n"))> 0. As shown below:

    The function of the formula is to match whether the current cell content is one of the values entered in the [Text Area] control.

    4.png


    2.4 Effect preview

    After saving the template, click "Pagination Preview" and enter the OrderID in the [Text Area] control. The effect on the PC side is shown in the figure below:

    5.gif

    3. Example-Dataset Filtering

    1) Refer to section 2.1 Design report.

    2) Refer to section 2.2 Add Text Area control.

    3) Modify the SQL statement in the ds1 data to filter the data in the dataset.

    The SQL statement is: 

    SELECT * FROM ORDERS where 1=1  ${if(len(AK)>0," and OrderID in ('" +replace(AK, "\n","','")+ "')","")}

    The SQL statement uses "in" to query the data of the OrderID entered in a new line in the Text Area control.

    4) After saving the report, the preview effect is shown in section 2.4.

    4. Template Download

    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