[#4090] - Any Sample REPORT_CONNECTION jasperclient Jasperserver php

Category:
General
Priority:
Urgent
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
N/A
Assigned to:

Hi,

I have tried to get a sample program via web service REST 2 (jasperclient) to jasperserver for PHP to pass the parameter of datasource connection to jasper report but no luck. Can anyone help !!!

What i am trying to do is to have one jasper report but it can work on different set of database just by passing the different datasource to it.

Example : i have 2 identical database called db1 and db2. so i create a repository of datasource called dsn1 for db1 and dsn2 for db2.
so, when i pass the db1, it will produce the report based on data in db1, whereas if i pass the db2, it will produce the report based on data in db2. is that possible ? i trying to work with REPORT_CONNECTION but no luck. Hope anyone can help !!!.

below is my program of how it call the jasperserver :-

$params = array('hostname' => 'localhost', 'port' => '8080', 'username' => 'jasperadmin', 'password' => 'jasperadmin',
'baseUrl' => '/jasperserver', 'orgId' => null);
$this->load->library('JasperClient', $params);

header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=report.pdf');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($report));
header('Content-Type: application/pdf');

$controls = array('REPORT_CONNECTION='db1', 'coid' => $co_id, 'trncd' => $sstrncd, 'frinvno' => $frinvoice, 'toinvno' => $toinvoice,
'frinvdt' => $frissdt, 'toinvdt' => $toissdt, 'frcuscd' => $frcus, 'tocuscd' => $tocus, 'dateformat' => $dtfmt,
'amtformat' => $amtfmt, 'qtyformat' => $qtyfmt);

$result = $this->JasperClient->runReport('/reports/issgst/$reportname', 'pdf', null, null, $controls);

echo $result;

please help !!!

Thank you.

Regards
Gilbert

v6.0.1
insolve's picture
16
Joined: Dec 11 2011 - 7:53pm
Last seen: 2 years 6 months ago
Feedback