Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » PHP BIRT Integration - parameter Passing
PHP BIRT Integration - parameter Passing [message #735338] Tue, 11 October 2011 10:46 Go to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason

I am having some problem to pass date parameters from php to birt via the javabridge.
I have declared a parameter in birt of datatype date. Then in my php code i am trying:

$task->setParameterValue("paramDtFrom", new java("java.util.Date", $DTFROM));

However, i am getting an exception error. Then i looked at the Java.inc file in the java bridge where the data types are declared and found the following piece of code:

function __call($method,$args) {
$client=$this->__client;
$sig="@{$this->__signature}@$method";
$len=count($args);
$args2=array($this->__java);
for($i=0; $i<$len; $i++) {
switch(gettype($val=$args[$i])) {
case 'boolean': array_push($args2,$val); $sig.='@b'; break;
case 'integer': array_push($args2,$val); $sig.='@i'; break;
case 'double': array_push($args2,$val); $sig.='@d'; break;
case 'string': array_push($args2,htmlspecialchars($val,ENT_COMPAT)); $sig.='@s'; break;
case 'array':$sig="~INVALID"; break;
case 'object':
if($val instanceof java_JavaType) {
array_push($args2,$val->__java);
$sig.="@o{$val->__signature}";
}
else {
$sig="~INVALID";
}
break;
case 'resource': array_push($args2,$val); $sig.='@r'; break;
case 'NULL': array_push($args2,$val); $sig.='@N'; break;
case 'unknown type': array_push($args2,$val); $sig.='@u'; break;
default: throw new java_IllegalArgumentException($val);
}

Does that mean that date data types cannot be passed via the javabridge?

Should i pass them as string values rather?

Thanks in advance..
Karvesh
Re: PHP BIRT Integration - parameter Passing [message #735373 is a reply to message #735338] Tue, 11 October 2011 11:22 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Set the parameter type to date-time and use code like:

//birt date-time parameter
$sdf = new java("java.text.SimpleDateFormat", "MM/dd/yyyy");
$mydt = $sdf->parse( "01/01/2004" );
$task->setParameterValue("MyDate", $mydt);


Jason

On 10/11/2011 10:46 AM, karvesh wrote:
> Dear Jason
>
> I am having some problem to pass date parameters from php to birt via
> the javabridge.
> I have declared a parameter in birt of datatype date. Then in my php
> code i am trying:
>
> $task->setParameterValue("paramDtFrom", new java("java.util.Date",
> $DTFROM));
>
> However, i am getting an exception error. Then i looked at the Java.inc
> file in the java bridge where the data types are declared and found the
> following piece of code:
>
> function __call($method,$args) {
> $client=$this->__client;
> $sig="@{$this->__signature}@$method";
> $len=count($args);
> $args2=array($this->__java);
> for($i=0; $i<$len; $i++) {
> switch(gettype($val=$args[$i])) {
> case 'boolean': array_push($args2,$val); $sig.='@b'; break;
> case 'integer': array_push($args2,$val); $sig.='@i'; break;
> case 'double': array_push($args2,$val); $sig.='@d'; break;
> case 'string': array_push($args2,htmlspecialchars($val,ENT_COMPAT));
> $sig.='@s'; break;
> case 'array':$sig="~INVALID"; break;
> case 'object':
> if($val instanceof java_JavaType) {
> array_push($args2,$val->__java);
> $sig.="@o{$val->__signature}";
> }
> else {
> $sig="~INVALID";
> }
> break;
> case 'resource': array_push($args2,$val); $sig.='@r'; break;
> case 'NULL': array_push($args2,$val); $sig.='@N'; break;
> case 'unknown type': array_push($args2,$val); $sig.='@u'; break;
> default: throw new java_IllegalArgumentException($val);
> }
>
> Does that mean that date data types cannot be passed via the javabridge?
>
> Should i pass them as string values rather?
>
> Thanks in advance.. Karvesh
Previous Topic:Html-output looks different from pdf
Next Topic:Dataset - More than one parameter
Goto Forum:
  


Current Time: Thu Aug 28 07:30:30 EDT 2014

Powered by FUDForum. Page generated in 0.02326 seconds