i'm new to DynamicJasper.
I'm building a report that contain a subreport, i can run my original report successfully without any error, but the subreport is not displaying.
I'm using DynamicReportBuilder(drb) for building my main report, i'm wondering i'm adding my subreport in the wrong way.
Below is how i build my subreport
private DynamicReport subReportTesting() throws Exception
{
DynamicReportBuilder drb = new DynamicReportBuilder();
DynamicReport dr = drb.addColumn(subAbstractColumn1)
.addColumn(subAbstractColumn2)
.addColumn(subAbstractColumn3)
.setPrintColumnNames(true)
.setIgnorePagination(true)
.setMargins(0, 0, 0, 0)
.setTitle("Sales Report")
.setSubtitle("This report was generated at " + new Date())
.setUseFullPageWidth(true)
.build();
return dr;
}
and here is how i add my main report and subreport.
public DynamicReport buildReport() throws Exception {
{
DynamicReportBuilder drb = new DynamicReportBuilder();
drb.setTitle("This is original report")
.setSubtitle("This is subtitle")
.setMargins(15, 15, 15, 15)
.setUseFullPageWidth(true);
.setDetailHeight(30);
.setAllowDetailSplit(true);
.addColumn(mainAbstractColumn1);
.addColumn(mainAbstractColumn2);
.addColumn(mainAbstractColumn3);
DynamicReport myDynamicReport = new DynamicReport();
try {
myDynamicReport = subReportTesting();
} catch (Exception e) {
e.printStackTrace();
}
SubReportBuilder srb = new SubReportBuilder();
srb.setDynamicReport(myDynamicReport, new ClassicLayoutManager());
try {
mySubReport = srb.build();
**drb.addConcatenatedReport(mySubReport);**
} catch (DJBuilderException e) {
e.printStackTrace();
}
DynamicReport myMainReport = drb.build();
return myMainReport;
}
My contents is add by using preparedStatement and HashMap.
I expect the subreport will display it's title, subtitle and column header even there is no data to be show in the subreport's content, but currently it show nothing about the subreport.
Please correct me if i make any mistake. Thank you so much.