JS parameter panel to display the corresponding data

  • Last update:  2021-11-22
  • I. Overview 

    1)  Expected Effect

    When our parameter linkage is displayed in the report, the linkage effect is realized by the customer's own choice. The customer wants to select parameters once in the parameter panel, and then some corresponding data can be displayed in the parameter panel, such as Auto Fill-in on the data entry interface. How to achieve this? It is also hoped that the label in front of the linked data will not be displayed when the template is opened for the first time, as shown below:

    gif.gif


    2)  Implementation Roadmap

    According to the Auto Fill-in section in the data entry, the corresponding data is also displayed in the parameter interface with SQL statements. When the template is opened for the first time, the label is not displayed, which can be controlled by JS.

    II.Example

    1.Creating a template

    Create a regular report, create a new dataset ds1.The SQL statement is:SELECT * FROM Product where CategoryID ='${ID}'; 


    2.Adding parameter widgets

    Edit the parameter panel, click Add All, and add the widget generated by parameter ID. The widget type is drop-down box widget, and the ID label is renamed as "Category ". The data dictionary settings for the drop-down box widget are as follows:

     1.png


    3. Adding Linkage widgets

    1) It is necessary to display customer details on the parameter panel, so two new label widgets,  name andinstruction, are added to the parameter panel. The widget values are Category name:  and Instruction:, as shown below:

    2.png

                                

    2) Add a label widget after the parameter panel, and the widget value selection formula is as follows: SQL ("FRDemoEN", "select Category_name from PRODUCTCATEGORY where CategoryID='" + $ID + '", 1, 1) The above sql means to execute the sql statement in the FRDemo connection to display the query results of the first column and the first row. According to different requirements, the last one can be removed here to display the query column. The parameter panel is represented as a comma-separated line form, as shown in the figure below:

    5.png

    3) Similarly, add label widgets after label widgets such as name and instruction of the category, and the widget value is formula, corresponding formula is as follow:

    • SQL ("FRDemoEN","select instruction from PRODUCTCATEGORY where CategoryID=' "+ $ID + '",1,1)

    After setting, the parameter panel is shown as follows:

    6.png


    4.Hidding the label settings 

    1) To realize that only the drop-down box will be displayed when the template is opened, and other labels will not be displayed, it is necessary to set all fixed labels as invisible. Click the name, instruction label widget to remove the visible check box in[Attributes > Basic Attribute], as shown below:

    7.png

    2) After editing the drop-down box, if the label on the parameter panel needs to be displayed again, you can add a After editing1 Event.

    8.png

    The JS code is as follows:

    var a=this.options.form.getWidgetByName("name");
    a.setVisible(true);
    var b=this.options.form.getWidgetByName("instruction");
    b.setVisible(true);


    5. Report body design

    1) Report design is shown in the figure below. Drag the corresponding fields into the corresponding cells:

    9.png

    2) Double-click A2 cell to set the filter of template parameters. The optional column is CategoryID. The operator is equal to and the parameter is $ID, as shown below:

    10.png


    6.Effect Preview

    1) PC

    After saving, click "Pagination Preview" to see the effect shown in Section Iof this article.

    2)Mobile

    Mobile terminal is not supported.

    III. Download the template

    See the completed template:%FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Parameter\JS_parameter_panel_to_display_the_corresponding_data. cpt

    Click to download the template: 

    JS_parameter_panel_ to_display_the_corresponding_data.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