Passing dynamic Multi-Select Collection Parameter via REST API to Jasper Report


I have created a JasperReport with a parameter P_LandListe which is of type java.util.Collection, there is no Default Expression and the Report can be started from the JasperStudio by passing in values which are comma separated in the P_LandListe parameter and the results are filtered correctly.

In the JasperServer I can only get the Report to filter correctly when I create an InputControl structure for example as a list or query. This was done to test the Rest API. When there is no InputControl structure the Report always returns all values as if nothing was entered in the parameter. With InputControl structure I can choose the values and it filters correctly directly in the JasperServer and when I use Postman to call the Rest API.I explicitly do not want to create an InputControl structure!!!

What I want to do is pass values to the parameter without any validation happening on the JasperServer or in the Report. I can do this with all other java.lang.String parameters for example P_Event can be empty or filled with any string.

I would like to do this for the Collection parameter (Multi-Select) by just passing all the values either comma separated using

"POST http://jaspersrv-dev:8080/jasperserver/rest_v2/reports/reports/Test/Test..." and in Body define

"P_LandListe" : ["AD","DE","US"]

and then run the report after they have been set, or  by passing the values to the parameter multiple times 

"GET http://jaspersrv-dev:8080/jasperserver/rest_v2/reports/reports/Test/Test..."

However this only works if I have previously defined an InputControl structure on the JasperServer for this parameter. I have even thought about creating an InputControl structure at runtime which only contains the values that I require but have not found a way of doing this.

I am now asking myself if this is acutally possible and would be very very thankful for any helpful hints in how to do this.

elp0mme's picture
Joined: Jun 8 2018 - 1:43am
Last seen: 11 months 4 weeks ago

0 Answers:

No answers yet