Jump to content
Changes to the Jaspersoft community edition download ×

SubReport Help with 2 XLSX sources


Recommended Posts

Ok, I need help with a simple but important problem. I've built a simple case for understand the problem much better.


I've 2 Excel file:

- Customer data "Customer.xlsx": (ID_Customer, Name, Surname)

-Address data "Address.xlsx": (ID_Address, ID_Customer, Address)


I would built a report that show the customer data and, for each customer, shown the address line (maybe each customer could have 1 or more address). 

So, I've created the main report with the fields Name and Surname in the details area. Under the fields I've created a sub-report component and I've also create the sub-report with the wizard process. So now I've the main report and the sub-report.

If I tried to show the data from each report... 

- From the main report I can see the list of customer but I cant'see anything from the sub-report component.

- From the sub-report I can see the the list of the addresses of the customer.


So I've realized that maybe I can't see the results of sub-report component in Main Report because I've not explicited the relationship between the two reports and what key create the link. So I ask you to describe me what is the problem, because I'm out of mind actually. Thanks so much.


Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Well you should pass the current Field-value $F{ID_Customer} to the SubReport as a so called SubReportParameter with name e.g. "Para_ParentCustomerID" from MainReport at the SubReport-Element.

Inside the SubReport itself you create a Parameter $P{Para_ParentCustomerID} (the same name is important!) and use this within the SubReportQuery. E.g. 

Select * From Adresses Where ID_Customer = $P{Para_ParentCustomerID}[/code]

That's all.. then the SubReport should filter out just the matching adress(es) from the current MainReport customer.

hth + regards


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...