Parameter Class Dataset

  • Last update:  2020-12-25
  • 1.Overview

    In practical applications, it may be necessary to dynamically change the data source according to the table name. For example, in the class dataset, the parameter table name is passed and used to retrieve the corresponding data table as the data source from the database. The parameter variable parameters used by the class dataset is a field that AbstractTableData inherits from its parent class AbstractParameterTableData.

    2.Example

    2.1 Define Class Data Source

    Define a class which inherits AbstractTableData and gets the methods implemented. Check out the following link to get more details:

    https://github.com/finereport-overseas/example/blob/release/10.0/src/main/java/com/fr/data/ParamTableDataDemo.java 


    2.2 Compile the Class

    Compile ParamTableDataDemo.java and copy the corresponding class file under the path %FR_HOME%\webapps\webroot\WEB-INF\classes\com\fr\data.         

    At this point, class data source has already been defined.


    2.3 Configure Class Dataset

    1) Create a report, create a class in the dataset panel and select the class file we have defined, as shown in the figure below:

    2) Add default parameters, the first parameter in the class is the table name, and the rest of the parameter names can be arbitrary. As shown below:


    2.4 Preview Class Dataset

    1) Choose the class dataset just created and click on the preview button, type in the parameter values,as shown below:

    2) Query results is shown below:

    3. Remarks

    3.1 Parameter Name Conflicts of Class Datasets in FRM

    1) Problem description

    Multiple class datasets are created in the decision report. The parameter names of each dataset are the same while the parameter values are different. The data displayed in the preview is the same.

    2) Reason

    If the parameter names of multiple class datasets are the same in the decision report, conflicts will occur.

    3) Resolution

    The parameter names of the class datasets in the decision report cannot be the same. If the same names exist, they need to be modified to be different ones.


    Attachment List


    Theme: Secondary Development
    • 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