Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » help with multiple parameter drill through using php/java bridge(Only first parameter is being processed)
help with multiple parameter drill through using php/java bridge [message #647335] Wed, 05 January 2011 16:51 Go to next message
Ryan Ott is currently offline Ryan OttFriend
Messages: 2
Registered: January 2011
Junior Member
I have been following the examples from Integrating BIRT with php and from the BIRT examples in the java bridge itself, however when drilling into another report that accepts multiple parameters only the first parameter is being passed.

Here is the loop that sets the parameters before the report is run. This is almost identical to the code in the example in the javabridge and the above link.

for ($i=0; $i < $parmarraysize; $i++) {
	$parmhandle = $sh->get($i);
	$parmname = $parmhandle->getName();
	$dt = $parmhandle->getDataType();
	$passedinvalue = $_REQUEST[java_values($parmname)];
	echo $parmarraysize."<br>";
	echo $i."<br>";
	if (isset($passedinvalue)) {
		if( strcasecmp(java_values($dt), "integer") == 0 )
		{
			$Parm = new Java("java.lang.Integer", (int)$passedinvalue);
			$task->setParameterValue($parmname, $Parm);
		}else if( strcasecmp(java_values($dt), "string") == 0 )
		{
			$Parm = new Java("java.lang.String", $passedinvalue);
			$task->setParameterValue($parmname, $Parm);
		}else if( strcasecmp(java_values($dt), "decimal") == 0 )
		{
			$Parm = new Java("java.lang.Float", (float)$passedinvalue);
			$task->setParameterValue($parmname, $Parm);
		}
	}
}


I'm echoing a few variables for debugging purposes. For a report with two parameters this results in

2
0

This means the report accepts two parameters, and the loop is in its first iteration. However, after this the code after the loop runs without the loop ever entering its second iteration.

I'm very confused by this as it appears that the loop should run for every parameter that the report accepts. Any help would be appreciated.

[Updated on: Wed, 05 January 2011 16:52]

Report message to a moderator

Re: help with multiple parameter drill through using php/java bridge [message #647364 is a reply to message #647335] Wed, 05 January 2011 19:09 Go to previous message
Ryan Ott is currently offline Ryan OttFriend
Messages: 2
Registered: January 2011
Junior Member
I've solved the problem the parmarraysize isn't an integer. After doing some type checking I found out that it is in fact an object. When it's used as an integer it defaults to 1, that's why the loop only iterates once. When it is echoed it uses some method to represent it as a string which is why it displayed the correct size. By casting this to a string and then checking it against $i the problem was alleviated.
Re: help with multiple parameter drill through using php/java bridge [message #647367 is a reply to message #647335] Wed, 05 January 2011 18:57 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you echoing parmarraysize?

Jason

On 1/5/2011 11:51 AM, Ryan Ott wrote:
> I have been following the examples from
> http://www.theserverside.com/news/1363642/Intergrating-BIRT- with-PHP and
> from the BIRT examples in the java bridge itself, however when drilling
> into another report that accepts multiple parameters only the first
> parameter is being passed.
> Here is the loop that sets the parameters before the report is run. This
> is almost identical to the code in the example in the javabridge and the
> above link.
>
> for ($i=0; $i < $parmarraysize; $i++) {
> $parmhandle = $sh->get($i);
> $parmname = $parmhandle->getName();
> $dt = $parmhandle->getDataType();
> $passedinvalue = $_REQUEST[java_values($parmname)];
> echo $parmarraysize."<br>";
> echo $i."<br>";
> if (isset($passedinvalue)) {
> if( strcasecmp(java_values($dt), "integer") == 0 )
> {
> $Parm = new Java("java.lang.Integer", (int)$passedinvalue);
> $task->setParameterValue($parmname, $Parm);
> }else if( strcasecmp(java_values($dt), "string") == 0 )
> {
> $Parm = new Java("java.lang.String", $passedinvalue);
> $task->setParameterValue($parmname, $Parm);
> }else if( strcasecmp(java_values($dt), "decimal") == 0 )
> {
> $Parm = new Java("java.lang.Float", (float)$passedinvalue);
> $task->setParameterValue($parmname, $Parm);
> }
> }
> }
>
> I'm echoing a few variables for debugging purposes. For a report with
> two parameters this results in
>
> 2
> 0
>
> This means the report accepts two parameters, and the loop is in its
> first iteration. However, after this the code after the loop runs
> without the loop ever entering its second iteration.
>
> I'm very confused by this as it appears that the loop should run for
> every parameter that the report accepts. Any help would be appreciated.
Previous Topic:Parameter in XPATH DataSet
Next Topic:Drill-Through - Hide Parameter Pager
Goto Forum:
  


Current Time: Fri Mar 29 07:44:00 GMT 2024

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

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

Back to the top