I am having a bunch of really irratic problems using PHP to access report Parameters. I am hoping that someone out there has a sample that actually works?
I am running the latest version of the library (just downloaded from Git). When I try to get the InputControls (JUST A LIST - not working with the controls yet), I get two errors:
NOTICE: Trying to get property of non-object in [blah blah/jrs-rest-php-client-master/src/Jaspersoft/Service/ReportService.php on line 58
WARNING: Invalid argument supplied for foreach() in [blah blah]/jrs-rest-php-client-master/src/Jaspersoft/Service/ReportService.php on line 58
I have NOT made any changes to the above Jaspersoft module.
*MY* code looks like the following.
$c = new Client ("MYIP", "MYACCT", "MYPSWD", "");
$input_controls = $c->reportService()->getReportInputControls ("REPORTNAME"):
Any and all suggestions would be greatly appreciated.
OK, so in case anyone else falls down this rabbit hole...
1) I have no idea what "Input Controls" USED to do but, currently, they are, for all intents and purposes, the same as Parameters.
2) However.... Input Controls DO NOT exist unless you specifically assign them in your PHP Code using runReport.
3) (So my problem was that I was trying to query Input Controls and the PHP Client does not do a good job (AT ALL) of checking to see if it has valid values. So I was crashing)
4) Input Controls is an array of arrays. Your parameters have to be an array, even if they have only one value, example: $controls = array ('Param1'=> array ("foo"), 'Param2'=>array("goo"));
4) Therefore, the right sequence is to (a) create a client object, (b) create an array of parmeters (see #4) and then call runRerport.
5) There is very little error checking. So if the parameter does not exist (case sensitive), or if the value is the wrong type, you'll get an often-meaningless (Java) stacktrace. It is meaningless because, depending on the state of TomCat, you may or may not get something you can use.
Hope this helps someone...