1
I’m having trouble opening a report with sub reports passing a datasource.
In Ireport I run the report with sub reports normally, but the main report is with a connection to the database and this connection is passed to sub reports and each of the reports has its query in the database.
This begs a doubt: when a list is passed to the report the SQL query in the report is unnecessary?
The application to call the report passes a datasource only that only the main report receives the data from the list and does not pass to the sub reports.
ex: in the main report has a locale field so I choose this item in the list, in the next sub report has a vendor field so the list coming from the main report is received and I choose the itemName item and in the other sub report have the movement with most of the data mass of the list where the columns are populated.
in the properties of the sub report in Connection type I have to put : Use the datasource Expression and in Connection Expression: "new net.sf.jasperreports.engine.data.Jrbeancollectiondatasource(list)".
The examples I find arrow the list in a report field. And in my case I want the list to reach the sub reports and each item in the list to fill a field in the report.
It follows the layout image of how I am doing the report: the main brings the localities the middle brings the suppliers of that locality and the latter brings the movement according to the supplier and the locality.
I also tried to do this in just one report with Groups but I could not get it to bring all suppliers from a locality and all related movements co supplier and locality. Anyone who has any idea how to call the report as is in the picture by the System I thank. Only one detail the system is WEB JSF + JPA + Hibernate.
The list passed is from the movement table that has relationships with several tables N:1 as: service, location and contract and this has relationship with supplier. And this list is filtered by the user by an initial date and an end date. In the figure I posted in Ireport the 1st report search all suppliers of a locality in the 2nd search all movement of a locality and the 3rd search the movement itself. When running in Ireport brings the data all grouped as in the figure but is done by a connection to the database.
– Alexsandro Lopes
The problem is to do this in the application that sends a list that are the report completion data. The list Is not an attribute of any class, but will send all data to complete the report.
– Alexsandro Lopes
Main report receives data from the list but sub reports do not.
– Alexsandro Lopes
@user17132 You cannot create the classes in the necessary structure and do a pre-processing of the data so that it stays in the structure that best suits the report?
– utluiz
utluiz, do not understand. give to explain better?
– Alexsandro Lopes