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

2

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: 3 years 11 months ago

4 Answers:

1

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.

elizam's picture
4293
Joined: Mar 5 2012 - 9:19am
Last seen: 1 month 1 week ago
0

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

hozawa's picture
50973
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
0

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

hozawa's picture
50973
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago
1
kkumlien's picture
2728
Joined: Jan 22 2015 - 4:36am
Last seen: 2 weeks 8 hours ago
Feedback