I have a report which receives a List parameter to use it in a IN clause:
$X{IN, personID, _personID}
The report works when running it through the web application or remote repository view in iReport.
Now I need to call it using the REST api. I have tried several different ways of passing the list value in my resource descriptor but none of them worked.
The above example returns the following error:
Invalid type java.lang.String for parameter _personId used in an IN clause; the value must be an array or a collection.
I have also try the following:
_personId
3
But this returns a report with all the records, not only the person with Id=3.
解决方案
My workaround for this problem was to use the REST V2 services of JasperServer.
Added to this the V2 has two advantages over the first version of the service:
it doesn't require a resource descriptor
it runs and exports the report in a single GET request
All the information required to run and export the report is passed through the request URL, for example:
/rest_v2/reports/Test/TestReport.html?_personId=3&_personId=4&_personId=5&_personId=6