Jump to content
We've recently updated our Privacy Statement, available here ×

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


elp0mme

Recommended Posts

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/TestMA3/inputControls/" 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/TestMA3.html?P_LandListe=DE&P_LandListe=AD&P_LandListe=US"

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.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...