I.Overview
1.Expected effect
When setting a hyperlink, you will encounter that the template you are linking to has parameters. It is hoped that when the hyperlink is clicked, the content of the current cell is passed as the parameter value to the parameter of the next report. As shown below:
2.Implementation method
Realize hyperlinks to templates with parameters through web reports or JavaScript scripts.
II. Example 1: Web Report
1.Sub-template
Create a new general report and save it as%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to a template with parameters-subreport.cpt
1)New Data Set
New data set ds1: SELECT * FROM [Sales_Volume] where 1=1 ${if(len(area) == 0,"","and Region ='" + area + "'")}
areais the name of a custom parameter, that is, the filter name (control name) of the corresponding area. Judge whether the control value is empty, if it is empty, query all by default.
2)Design report
The report page design is shown in the figure below:
Select cell C2, select cell element> basic, and set the data to summary and sum. As shown below:
2. Master template
Create a new general report and save it as%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to the template with parameters-the main report.cpt
1)New Data Set
New data set ds1: SELECT * FROM Sales_VolumeAs shown below:
The report page design is shown in the figure below:
Select cell C2, select cell element> basic, and set the data to summary and sum. As shown below:
3.Set up hyperlinks and pass parameters
Open Hyperlink to the template with parameters-the main report.cpt, select cell A2, and click the hyperlink to add a network report.
Web report select/Hyperlink to the template with parameters-the main report.cpt,the link will open in a new window, set the parameter area=$$$
As shown below:
4.Effect preview
1)PC terminal
Save the template and click Pagination Preview to preview. As shown below:
2)Mobile
The preview effect of App and HTML5 is shown in the figure below:
III.Example 2: JavaScript script
1.Template settings
Sub-template settings are consistent with section 2.1 of this article, save as %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to template with parameters-subtemplate.cpt
Sub-template settings are consistent with section 2.1 of this article
%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to template with parameters-sub-template.cpt
2The main template settings are consistent with section 2.2 of this article
%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to the template with parameters-the main report.cpt
2.Set up hyperlinks and pass parameters
Open Hyperlink to a template with parameters-JavaScript script.cpt, select cell A2, click the hyperlink, and add the JavaScript script.Set parameter A=A2, add JavaScript code, as shown in the figure below
The JavaScript code is as follows:
window.open("${servletURL}?viewlet=Hyperlink to a template with parameters-sub-template.cpt&op=view&area="+A);
3.Effect preview
Save the template and click on the page to preview. Click "East China" to jump to the sub-template, and the sub-template only displays the data in the "East China" part. As shown below:
Note: Mobile terminal is not supported.
IV. Template Download
4.1 Example 1: Network report
1)Master template
Click to download the template: Hyperlink to the template with parameters-the main report.cpt
2)Sub-template
Click to download the template: Hyperlink to a template with parameters-subreport.cpt
4.2 Example 2:JavaScript
2)Master template
Click to download the template: Hyperlink to a template with parameters-JavaScript script.cpt
2)Sub-template
Click to download the template: Hyperlink to a template with parameters-sub-template.cpt