Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Problem with php/javabridge and multiple parameter drill throughs
raozmc
Below is the code I'm using to handle the parameters for my sub report. Essentially this is the example code that was included with the bridge. I'm echoing a few values for debugging purposes. The only parameter that is passed is the first parameter. For a report that has two parameters this code results in
2
0
StoreNum
Integer 1
0
2
and then moves on to the code after the loop without reentering the loop. I'm sure I'm making a basic mistake, but I do not understand why the loop is not reentered. Has anyone encountered a similar problem or does anyone see my error? I'd appreciate any feedback.
//Match request parameters with detail report parameters
$sh = $report->getDesignHandle()->getParameters();
$parmarraysize = $sh->getCount();
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)) {
echo $parmname."<br />";
echo $dt." ".$passedinvalue."<br>";
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);
}
}
echo $i."<br>";
echo $parmarraysize."<br>";
}
Find more posts tagged with
Comments
raozmc
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.
The reason the example works is because there is only one parameter being passed in the drill down.