0

SQL-less Subreport JasperReport

I spent almost an hour trying to remember how to achieve this. To have this readily available in the future, thus this “documentation”.

Software Applications used:
a. MySQL Server 5.6.11
b. iReport 2.0

1. Install MySQL Server, create a connection profile in iReport, and make profile the default connection

jasperreports-subrpt001

2. Use a simple SQL Select statement for the main report

jasperreports-subrpt002

3. Create a subreport and create 3 parameters

jasperreports-subrpt003

4. Do not put any SQL Select statement on the subreport

jasperreports-subrpt004

5. Make sure the data types match with that of passed arguments

jasperreports-subrpt005

6. Main Report and Subreport

jasperreports-subrpt006

7. Configure subreport on the main report

jasperreports-subrpt007

8. On the subreport, make sure “When no data” is set to “All sections, no detail”

jasperreports-subrpt008

9. Compile reports

jasperreports-subrpt009

jasperreports-subrpt010

10 On the iReport, run the main report via Execute (with active connection) command. Make sure SUBREPORT_DIR points to the path where the compiled reports are.

jasperreports-subrpt011

 

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert