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)
Birt drillthrough data type issue
Arif shah
Hello all, <br />
<br />
I am trying to perform some drillthrough in my birt report through php. The master report runs fine, but when i drill through , i am getting some data type errors. Can you please look into this and tell me what mistake am i making. The code of master report is given below<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<?php
define ("JAVA_HOSTS", "127.0.0.1:8081");
define ("JAVA_SERVLET", "/JavaBridge/JavaBridge.phpjavabridge");
$pth = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$path_parts = pathinfo($pth);
$imageURLPrefix = $path_parts['dirname'] ."/sessionChartImages/";
$URLPrefix = $path_parts['dirname'] . "/PhpRunAndRenderHTMLDrillDetail.php";
require_once("/JavaBridge/java/Java.inc");
session_start();
$here = getcwd();
$ctx = java_context()->getServletContext();
$birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
try{
$report = $birtReportEngine->openReportDesign("C:\Users\Arif\Documents\WorkSpace\c.rptdesign");
$task = $birtReportEngine->createRunAndRenderTask($report);
$task->setParameterValue("Customer Id", new java("java.lang.Integer", 1));
$taskOptions = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption");
$outputStream = new java("java.io.ByteArrayOutputStream");
$taskOptions->setOutputStream($outputStream);
$taskOptions->setOutputFormat("html");
$ih = new java( "org.eclipse.birt.report.engine.api.HTMLServerImageHandler");
$taskOptions->setImageHandler($ih);
$taskOptions->setBaseImageURL($imageURLPrefix . session_id());
$taskOptions->setImageDirectory($here . "/sessionChartImages/" . session_id());
$taskOptions->setBaseURL( $URLPrefix);
$task->setRenderOption( $taskOptions );
$task->run();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
echo $outputStream;
?>
</pre>
<br />
The above code is running fine. However, when i drillthrough to the below report, it gives an error The detail report code is given below<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<?php
define ("JAVA_HOSTS", "127.0.0.1:8081");
define ("JAVA_SERVLET", "/JavaBridge/JavaBridge.phpjavabridge");
$pth = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$path_parts = pathinfo($pth);
$imageURLPrefix = $path_parts['dirname'] ."/sessionChartImages/";
require_once("/JavaBridge/java/Java.inc");
session_start();
$here = getcwd();
$ctx = java_context()->getServletContext();
$birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook());
try{
$rpt = $_REQUEST['__report'] ;
if( substr(PHP_OS,0,3) == 'WIN' ){
$rpt = substr($rpt, 1);
}
$report = $birtReportEngine->openReportDesign($rpt);
$task = $birtReportEngine->createRunAndRenderTask($report);
//Match request parameters with detail report parameters
$sh = $report->getDesignHandle()->getParameters();
$parmarraysize = $sh->getCount();
$i = 0;
while ($i < $parmarraysize) {
$parmhandle = $sh->get($i);
$parmname = $parmhandle->getName();
$dt = $parmhandle->getDataType();
$passedinvalue = $_REQUEST[java_values($parmname)];
if (isset($passedinvalue)) {
if( strcasecmp(java_values($dt), "integer") == 0 )
{
$Parm = new Java("java.lang.Integer", $passedinvalue);
$task->setParameterValue($parmname, $Parm);
}else if( strcasecmp(java_values($dt), "string") == 0 )
{
$Parm = new Java("java.lang.String", $passedinvalue);
$task->setParameterValue($parmname, $Parm);
}
//... add additional data types here
}
$i++;
}
$taskOptions = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption");
$outputStream = new java("java.io.ByteArrayOutputStream");
$taskOptions->setOutputStream($outputStream);
$taskOptions->setOutputFormat("html");
$ih = new java( "org.eclipse.birt.report.engine.api.HTMLServerImageHandler");
$taskOptions->setImageHandler($ih);
$taskOptions->setBaseImageURL($imageURLPrefix . session_id());
$taskOptions->setImageDirectory($here . "/sessionChartImages/" . session_id());
$task->setRenderOption( $taskOptions );
$task->run();
$task->close();
} catch (JavaException $e) {
echo $outputStream;
?>
</pre>
<br />
The above code is written by Jason Weathersby and i am using it for my application. I am getting the below error<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Notice: Object of class java_InternalJava could not be converted to int in C:\wamp\www\BirtBridgeTest\PhpRunAndRenderHTMLDrillDetail.php on line 33
Call Stack
# Time Memory Function Location
1 0.1201 713360 {main}( ) ..\PhpRunAndRenderHTMLDrillDetail.php:0
( ! ) Notice: Undefined index: Customer Id in C:\wamp\www\BirtBridgeTest\PhpRunAndRenderHTMLDrillDetail.php on line 38
Call Stack
# Time Memory Function Location
1 0.1201 713360 {main}( ) ..\PhpRunAndRenderHTMLDrillDetail.php:0
( ! ) Notice: Object of class java_InternalJava could not be converted to int in C:\wamp\www\BirtBridgeTest\PhpRunAndRenderHTMLDrillDetail.php on line 33
Call Stack
# Time Memory Function Location
1 0.1201 713360 {main}( ) ..\PhpRunAndRenderHTMLDrillDetail.php:0
</pre>
<br />
Can someone please look into this and tell me what mistake am i making<br />
<br />
Arif
Find more posts tagged with
Comments
JasonW
Arif,
Any chance you could create two reports: a master and a detail using the sample db that shows the issue so I can run and debug it?
Jason