How to achieve the effect of the linkage between the parameters and reporting

In the interaction analysis, real-time reports often need to change according to the parameters. That is "parameter interaction" effect, the following example shows how to run through a dry report is to achieve this demand.

Left of the page as a parameter input area, the data need to report to the right of the real-time parameter query result to the following figure:

imagepng

Implementation steps:

1 Preparing reports

The default connection demo data source, the report prepared as follows:

imagepng

Among them, the report parameters are:

imagepng

Parameters for receiving regions and cities.

Report data set:

imagepng

imagepng

2 defined parameter input

Defined parameter input page, as follows:

<html> 

<head> </head>
<body>

<table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr> <td valign="top"  align="center" width="10%">
<a >请选择参数:</a><br><br>

<form> <select name="area" onChange="change(1,this.options\[this.selectedIndex\].value)">

<option value="华北" selected="selected">华北</option> <option value="东北">东北</option>

<option value="华南">华南</option> <option value="华东">华东</option> </select> <br><br>
<select name="city" onChange="change(2,this.options\[this.selectedIndex\].value)">
<option value="北京">北京</option> <option value="天津">天津</option> <option value="上海">上海</option>
<option value="长春">长春</option> </select> </form> </td> <td width="90%">

<iframe width="100%" height="100%" frameborder="0" align="left" src="autoQuery.jsp?rpx=demo.rpx&area=华北&city=北京" scrolling="auto" id="report" name="report"> </td> </tr>
<table>
</body> </html>

Wherein the data statements are embedded iframe, the reports published in the installation package showReport.jsp Run Dry statements. It should define the drop-down box onChange event. JS code by adding the following:

<script type="text/javascript">

function change(type,value){
var url = parent.document.getElementById("report").src;
var arr = url.split("&"); var area = arr\[1\].split("=")\[1\];

var city = arr\[2\].split("=")\[1\]; if(type==1) area=value;
if(type==2) city=value;

document.getElementById("report").src="showReport.jsp?rpx=demo.rpx&area="+area+"&city="+city
} </script>

Thus, after selecting parameter triggers the onChange event, you can achieve linkage query performance by automatically modify the iframe src attribute.

Guess you like

Origin www.cnblogs.com/xiaohuihui-11/p/12041823.html