How to pass list of objects to Subreport?

1

I have the iReport plugin on netbeans. I already configured the classpath to recognize my classes, I do the following steps:

1st - Send the list of objects Boletim to the main report, each bulletin has information of a student. (This part works, I can generate the data.)

2 - Send the 7 NOTES lists to the subreport, within the Boletim object has a Bimestre1 , Bim2 object, B3 , B4 , Exam , Annual Media and Final Media Bimestre . Each% has a list of Bimestre , Each note has the attributes of name of the subject, note and absence.

I need to submit subreport all the note lists.

So I need to send the lists to the subreport in this way

boletim.getBimestre1().getNotas(); //List<Nota>
boletim.getBimestre2().getNotas();//List<Nota>
boletim.getBimestre3().getNotas(); //List<Nota>
boletim.getBimestre4().getNotas();//List<Nota>
boletim.getExame().getNotas(); //List<Nota>
boletim.getNotasAnuais(); //List<Nota>
boletim.getNotasFinais(); //List<Nota>

All these sent lists have the same size, for each iteration in the Notas is accessed the next note of the past list

Main report - here it contains the Bulletin object, where it has the data of the class and the student. You also have note lists, these should be sent to the subport.

MySubreport(hereyoushouldreceivethe7memolistssoyoucanaddtheinformationinthelinesbelowtheheader,wherethecellsareblank.)

Researchingalittleofthis form , but only sends a list, I need to send at least 7 lists

    
asked by anonymous 26.10.2015 / 16:37

2 answers

0

Dude, if it's still helpful, I've done this tutorial for what you need: Report Tutorial with subellariations in this case I had a subreport within a list, plus if this is your main report, the steps are the same.

    
17.11.2015 / 20:01
0

I do not particularly like to leave intelligence to Jasper, my suggestion is you create a DTO of notes per discipline, and would fill this in java.

The idea is that this DTO contains as attributes each of the columns you need in the report.

public class NotaDTO {
    String disciplina;
    Double notaPrimeiroBimestre;
    Double notaSegundoBimestre;
    Double notaTerceiroBimestre;
    Double mediaAnual;
    Double mediaFinal;
    Integer falta;
}

You should then fill in the information from these lists (in your case 7) with the information for each discipline / bimester. This way you would only pass a list of your NotaDTO as Collection of your subreport.

Note: I suggest you rethink the way you structured your project, because there is no object to represent the Discipline?

    
18.11.2015 / 16:10