I. Overview
1.1 Problem
In the production of making reports, we often use the redirection of reports to carry parameters from one report to another, on click or regularly. At this time, we need to use JS for assistance.
1.2 Solution
Use the following JS:
window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");
II. Example 1: redirect regularly
2.1 Master report
1) Open report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Dashboard\Cost Gateway.frm
2) In the widget settings on the right, select body and add an event after initialization:
JavaScript:
setTimeout(function() {
window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");
}, 2000);
3.2 Sub report
1) Open report %FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Dashboard\Sales Analysis.frm
2) In the widget settings on the right, select body and add an event after initialization:
JavaScript:
setTimeout(function() {
window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Cost Gateway.frm");
}, 2000);
3.3 Preview effect
The template jumps from one report to another every 2 seconds, realizing automatic rotation, and the effect is shown in the following figure:
III. Example 2: redirection on click
Bind a redirection event to a widget.
3.1 Report modification
Also take the above two dashboards as an example. Delete the after initialization events of the body of the two reports.
For Cost Gateway.frm, select the chart0 widget, and add click events, as shown below:
JavaScript:
window.location = FR.cjkEncode("${servletURL}?viewlet=demo/Dashboard/Sales Analysis.frm");
3.2 Preview effect
The report will be redirected after clicking on one block.
IV. Download template
5.1 Example 1: redirect regularly
1) Master report:
2) Sub report