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

Can you use more than one Data source to run a report?


lhopfensperger
Go to solution Solved by elizam,

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

If you want these in different components in your report, (for example, Resource data in Table1, Financial data in Table2), you can use subreports, or you can create multiple datasets in your report, and then use  different datasets for different components. You do not have to use subreports.  If you go this way and you are using JSS, and your subdataset has a datasource that is different from the data source in the main report, you need to set a property for each dataset that "glues" the data source to the sub dataset, otherwise the dataset just inherits the data source used by the main dataset.  This property can now be set in the Dataset tab of the Properties view when a dataset is selected and is called "Default Data Adapter."  In JasperReports, it is the net.sf.jasperreports.data.adapter property.

If you want to combine information from different tables in the same datasource, for example, Resource data and Financial data in the same table, you can add a join statement in the initial query when you create the report.  You can also make subdatasets, if you need to construct different joins. Your query does have to return a single table  I assume there's a key field of some kind you can join on, or this scenario doesn't make sense.

If you want to combine information from two different data sources, for example and Oracle database and a Mongo DB datasource, in the same table, I'm not sure.  You could construct the join outside of JasperReports and write to a file or URL and then set that up as a data source.  You can write a custom data source as well.  I don't know if there is an easier way of doing this.

Link to comment
Share on other sites

  • 1 year later...

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