Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Problem in passing query string parameters from HTML to beforeOpen method of BIRT (Problem in passing query string parameters from HTML to beforeOpen method of BIRT )
Problem in passing query string parameters from HTML to beforeOpen method of BIRT [message #1003895] Tue, 22 January 2013 02:49 Go to previous message
Saroj Suaro is currently offline Saroj Suaro
Messages: 2
Registered: January 2013
Junior Member
Hi,

I have a HTML external to BIRT deployment which has following:

	<table id="graphid">
	<tr>
		<td>
			<b>Choose Parameters:</b>
		</td>
		<!--<td>
			<input type="hidden" name="__report" value="DynamicRpt.rptdesign" />
		</td> -->
		<td>
			<SELECT NAME="choiceX" id="choiceX">
					<OPTION VALUE="Country">Country
					<OPTION VALUE="Platform">ApplicationPlatform
					<OPTION VALUE="Application">Application
					<OPTION VALUE="Team">SponsoringBU
			</SELECT>
		</td>
		<td>
			<SELECT NAME="choiceY" id="choiceY">
					<OPTION VALUE="Count">ByCount
					<OPTION VALUE="Percentage">ByPercentage					
			</SELECT>
		</td>
		<td style="padding-left: 3em">
			<b>Choose A Graph Type:</b>			
		</td>
		<td>
			<SELECT NAME="graphType" id="graphType">
					<OPTION VALUE="Bar">BarChart
					<OPTION VALUE="Line">LineChart					
			</SELECT>
		</td>
	</tr>	
	<tr>		
		<td>
			<a href="#" onclick="showGraphData();">Draw Graph</a> 
			<!-- <input type="submit" value="Draw Graph"/> --> 
		</td>		
	</tr>
	</table>


	<table>
	<tr>
		<td>
			<iframe id="show_graph" name="show_graph" height="500px" width="950px" scrolling="no" frameborder="0" style="display:block"></iframe>
		</td>
	</tr>
	</table>


In the Javascript function in above HTML, I have following:

<SCRIPT language="JavaScript">
function showGraphData(){
	var theDivGraphData = document.getElementById('show_graph');
	var theDivX = document.getElementById('choiceX');	
	var theDivY = document.getElementById('choiceY');
	var graphType = document.getElementById('graphType');
	var x = theDivX.options[theDivX.selectedIndex].value+","+theDivY.options[theDivY.selectedIndex].value+","+graphType.options[graphType.selectedIndex].value;

	var graphURL = "/Birt/run?__report=DynamicRpt.rptdesign"+"&choice="+x;
	theDivGraphData.src = graphURL;
}
</SCRIPT>


In the beforeOpen of the Data Set, I have following:

var y = params["choice"];
var z = y.split(',');

if (z[0] == "Country" && z[1] == "Count" && z[2] == "Bar"){ 
	this.queryText = "";
}else{ 
	this.queryText = "";
}


I only want to check if the HTML user selected attributes are passed successfully to BIRT script or not but I'm getting below exception:

The following items have errors:

ReportDesign (id = 1):
+ There are errors evaluating script "var y = params["choice"];
var z = y.split(',');

if (z[0] == "Country" && z[1] == "Count" && z[2] == "Bar"){ 
 this.queryText = "";
}else{ 
 this.queryText = "";
} 

":
Fail to execute script in function __bm_beforeOpen(). Source:
------
" + var y = params["choice"];
var z = y.split(',');

if (z[0] == "Country" && z[1] == "Count" && z[2] == "Bar"){ 
 this.queryText = "";
}else{ 
 this.queryText = "";
} 

 + "
-----
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: Report parameter "choice" does not exist.
 Script source: /report/data-sets/oda-data-set[@id="8"]/method[@name="beforeOpen"], line: 0, text:
__bm_beforeOpen(). (Element ID:1)


Please help to suggest what am I doing wrong here. It says Report parameter "choice" does not exist. which is true as I'm passing the parameter thru query string URL.

Thanks,
Saroj
 
Read Message
Read Message
Previous Topic:crosstab dimension drilldown
Next Topic:How to get all Label controls using Designer API?
Goto Forum:
  


Current Time: Fri May 24 17:54:35 EDT 2013

Powered by FUDForum. Page generated in 0.01958 seconds