Passing input parameters in php rest_v2 client array returns only the first value of the array

0

Hi,

When I run a report from my php application with one parameter it works fine.
But when passing more than one parameter, only the first one in the array is passed to the report.
When changing the input parameters in the php array, then still the first one is passed to the report.
All the individual parameters are working like they should in the report when I pass them.

This is my php code:

$controls = array("REPORT_LOCALE" => array("NL_BE"),"Parameter1" => array("Param1"),"CMS_USER_ID" => array("123"));                  
$report = $client->runReport('/reports/VZVB/License_List_1_NL', 'pdf', null, $controls);
 
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');
echo $report;
 
In this example only the "REPORT_LOCALE" parameter is passed to the report. All the others return null in the report.
I tried somewhat everything (single quotes, double quotes, ...)
Thanks for any help. 
 
Regards
bartv2000's picture
Joined: Aug 31 2012 - 2:17am
Last seen: 3 years 11 months ago

1 Answer:

0

Hi, it seems that you are using an old version of the PHP client. I would suggest checking out the latest version on Github and reading the provided documentation. It is very likely that this was a previous bug that has been taken care of by the latest version of the client.

 

You can obtain the latest version of the PHP client from the Releases page of the community site, or you can visit Github: http://github.com/Jaspersoft/jrs-rest-php-client

grantbacon's picture
Joined: Oct 23 2012 - 1:10pm
Last seen: 1 year 5 months ago

Hi grantbacon,

I tried the new client but I did not get it working yet...
But I found the problem with the old client.
The parameters in the webservice call where badly formatted with & in the url query. I changed the "http_build_query(array('page' => $page) + (array) $inputControls))" function call in the runReport function into "http_build_query((array('page' => $page) + (array) $inputControls), '', '&'));" and now it is nicely formatted. Some webservers ignore the amp; in the url query but seems that tomcat servers have problems with it.

Thanks for your help!

Regards

bartv2000 - 5 years 5 months ago
Feedback
randomness