Search code examples
jasper-reportsjasperserver

Get List of Values (LOV) from sql query in JasperReport


In Oracle Reports I am able to run reports which get parameters by querying from database. In PHP/mySQL I am able to populate data in HTML dropdown menu by using sql query.

I would like to do the same in my JasperReports, either using JasperReport Studio or using JasperReport Server input controls. The current LOV I am able to get using JReport 'Input Controls' makes me enter options manually.

This is what I am trying to explain in words:

Get Jasper report to show LOV/dropdown menu to display data from my database table


Solution

  • You can do this with an Input Control in JasperServer. When in the Create Input Control page of the wizard choose a Type of Single-select Query. This will enable you to enter a SQL query so you can provide a list of options from the database.

    There is also a Multi-select Query alternative.