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

I need information from multiple data sources to be able to run certain reports.  Example: Resource data, Financial data and Project data is needed for one consolidated report.  How can I do this?

lhopfensperger's picture
Joined: Nov 18 2015 - 8:25am
Last seen: 7 years 2 months ago

4 Answers:

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

elizam's picture
Joined: Mar 5 2012 - 9:19am
Last seen: 2 years 6 months ago

It's possible to use subreports each with it's own datasource.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 7 months ago

Another possibility is to use Jaspersoft ETL to consolidate data to be used in a report.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 7 months ago
kkumlien's picture
Joined: Jan 22 2015 - 4:36am
Last seen: 3 weeks 1 day ago