1
I am trying to make a report where each code has x clients. Example
Code 1:
Bruno
Rodrigo
Fernando
Code 2:
Rafael
João
I retrieve these codes from a database, example:
1 Bruno
1 Rodrigo
1 Fernando
2 Rafael
2 João
As you can see, the codes are repeated in this way when I repeat my report which contains a sub-report, all that amount is repeated and the report becomes huge.
In short, how could I leave this report as the first example presented?
public void gerarRelatorio(List<PreEmissao> lista, String contrato) throws JRException {
Map<String, Object> parametros = new HashMap<String, Object>();
/**Parametros, essa lista é o DataSource do sub relatório*/
parametros.put("SUBREPORT_DIR", "src/main/resources/Report/Faturamento_subreport.jasper");
parametros.put("lista", lista);
JasperReport jasperReport = JasperCompileManager
.compileReport(getClass().getClassLoader().getResourceAsStream("Report/Faturamento.jrxml"));
/**Essa lista que é passada carrega o DataSorce do relatório principal, dela eu só pego o código*/
JasperPrint print = JasperFillManager.fillReport(jasperReport, parametros,
new JRBeanCollectionDataSource(lista));
JasperExportManager.exportReportToPdfFile(print, "D:/Ouvidoria/Relatorio" + contrato + ".pdf");
System.out.println("Relatório gerado.");
}
Do you want to group by code? Can you include the image of how it is currently and the expected result?
– Bruno César
The report got very big @Brunocésar, would be basically this, display customers according to the code.
– DiegoAugusto
When it is generated it displays code 1 and in sub report all data is displayed
– DiegoAugusto
For example, if I have 5 records with code 1 it generates a sub report for each record that has code 1, the goal is to generate only 1 that contains all clients that have the code 1
– DiegoAugusto
I solved the problem
– DiegoAugusto