Skip to main content



      Home
Home » Archived » 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 next message
Eclipse UserFriend
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
Re: Problem in passing query string parameters from HTML to beforeOpen method of BIRT [message #1004129 is a reply to message #1003895] Tue, 22 January 2013 11:18 Go to previous message
Eclipse UserFriend
Hi,

Is this "choice" parameter defined in the report? A birt report does not work like a http request: even if your parameter is passed through a query string, it must be created first in the .rptdesign. If you don't want your users to see it when opening parameters dialog, just check "hidden" property for this parameter.
Previous Topic:crosstab dimension drilldown
Next Topic:How to get all Label controls using Designer API?
Goto Forum:
  


Current Time: Mon Mar 17 15:01:00 EDT 2025

Powered by FUDForum. Page generated in 0.02803 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top