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:
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:
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) 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:
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:
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:
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.
The JS code is as follows:
5. Report body design
1) Report design is shown in the figure below. Drag the corresponding fields into the corresponding cells:
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:
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