Jump to content
We've recently updated our Privacy Statement, available here ×

how to use a subreport based on different datasource


pbrzek
Go to solution Solved by Giulio Toffoli,

Recommended Posts

Hi,

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?

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

  • Solution

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

 

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...