Parameter query any table in the database

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

    1. Expected effect

    Select any table name for query, you can find out the content of the table. As shown below:

     

     

    2. Implementation ideas

    • Use the TABLEDATAFIELDS() formula to get the column name of each column of the data set

    • Use the ds1.select() formula to get the contents of the corresponding column. For the use of ds1.select() formula, please refer to the use of ds1.select() and ds1.group() functions .  


    II. Operation steps

    1. Data preparation 

    In the FineReport designer, click File>New General Report , create a new template data set ds1, the SQL statement is: select * from ${table}  

    As shown below:

     


    2. Template design

    • Right-click on cell A1 , select Cell Element>Insert Formula , the formula is: TABLEDATAFIELDS("ds1") 

            Right-click on cell A2, select Cell Element>Insert Formula , the formula is: ds1.select(A1) .

     

    • Select cell A1 , and select "Horizontal" in the Cell Attributes> Expand> Expansion Direction in the right property panel ; 

            Select cell A2, and select "Vertical" in Cell Attributes> Expand> Expansion Direction in the right property panel .

            The following figure shows the setting steps of cell A1, and the setting steps of cell A2 are the same as those of cell A1 . As                shown below:  

     


    3. Parameter panel 

    •  Add the parameter "table" in the parameter panel, as shown in the figure below:

    • Select "Drop-down Box widget" for the widget, and the widget value is "sale";

            When setting the Data Dictionary, the type setting is selected as "Formula", and the actual value formula is: TABLES("FRDemo") .

            As shown below:


    4. Preview effect 

    1) PC side

    Save the template, click Pagination Preview , the effect is the same as the "expected effect" in chapter I-1 of this article.


    2) Mobile 

    • APP

    • HTML5

     


    III. Completed template 

    For the completed template, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\DynamicSQL\Parameter_query_any_table_in_the_database.cpt

    Click to download the template: Parameter_query_any_table_in_the_database.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