I've 1 mainreport.xrml and this report has a subreport.xrml.
So when I compile my report without giving the report any reference to my subreport it generates my report fine, but when I give the reference inside the report.xrml to my subreport, it asks me for my subreport.jasper
Here is my java code to do the compiling:
JasperReport report = null;
JasperReport report2 = null;
JasperPrint jasperPrint = null;
StringBuilder pathReport = new StringBuilder();
try {
name = config.getProperty(Constants.PATH_JRXML) + name + SUFFIX;
String name2 = "";
if (tipoReporte.equals("mensual")) {
} else {
int a = 0;
name2 = "C:\\mail\\reporteIncidenciasDiarias.jrxml";
report2 = JasperCompileManager.compileReport(name2);
}
report = JasperCompileManager.compileReport(name);
jasperPrint = JasperFillManager.fillReport(report, mapParams,
new JRBeanCollectionDataSource(params));
pathReport.append(config.getKeyValue(Constants.PATH_REPORT));
String nombreReporte = config.getKeyValue(Constants.NAME_REPORT);
if (tipoReporte.equals("mensual")) {
nombreReporte += "Mensual";
} else {
nombreReporte += "Diario";
}
pathReport.append(nombreReporte);
pathReport.append(DateUtils.formatear(new Date(), Constants.PATTERN_DATE_2));
pathReport.append(Constants.FILE_EXT);
JasperExportManager.exportReportToPdfFile(jasperPrint, pathReport.toString());
logger.info("Reporte generado " + pathReport);
} catch (JRException e) {
logger.error(e);
throw new Exception(e);
} catch (Exception ex) {
logger.error(ex);
throw new Exception(ex);
}
return pathReport.toString();
What should I do so it doesn't ask me for my subreport.jasper or how can I get my subreport.jasper?