how to use a subreport based on different datasource


New to jasper studio so any help is appreciated.  Here is the problem I am facing:

I have a master report that uses datasource with a group to display information on a specific group that contains users.  I have created a subreport using different datasource, new report, that contains details of the user information.   I followed the subreport creation documentation available on the web site where a parameter is specified in te subreport query.  I am able to preview the subreport and information looks OK however when I run the master report subreport shows blank.  Any ideas what could be and issue or how can I debug this?


pbrzek's picture
Joined: Mar 6 2014 - 7:37am
Last seen: 9 years 5 days ago

2 Answers:

There are two options:

1. The subreport is not getting data

2. The subreport is not found, and JasperReports ignores it

How to check both the problems:

Set the report used as subreport to print all bands and not details if there is no data (it is a checkbox in the report properties). Put something in the title band of the subreport. In this way, if the report is found, it is show up, and if does not contain any data, you will see at least the title band.



giulio's picture
Joined: Jan 2 2007 - 4:15pm
Last seen: 1 week 5 days ago

Are you sure that the band in which you placed the subreport is large enough? If it's too small, you won't see the subreport when you run it.


ilona's picture
Joined: Aug 2 2012 - 11:06am
Last seen: 8 years 8 months ago

Thanks for the response. I did checked the size of the band where the subreport is located and this is not the issue. While doing little more testing I see that when the data source expression is empty no subreport shows up but if I specify new empty JRDataSource the subreport shows but the prints null values for the field, as if the subreport is not reading it's own datasource.

So, the question that I face now is how to force the subreport to use it own datasource based on the adapter specified for the report.

pbrzek - 9 years 2 weeks ago