Can jasper reports use filterable custom data sour

2019-07-23 02:43发布

问题:

I'm looking at using Jasper Reports to handle reporting for a large database (tens of gigabytes of data), but my data uses an EAV format. As far as I can tell, this means I'd need to use a custom data model, as a Java class implementing JRDataSource. The amount of data I'm dealing with, however, means that simply implementing the interface would force the report to fetch and filter far too much data. I'd need to push the filtering duties to the database system to get any practical speed, but I can't see any way for the custom data source to get the filtering parameters from the report. Is it possible with Jasper Reports? Are there any examples or tutorials for this sort of scenario?

To clarify, I want to do this sort of thing: Say I have wanted a report on the maximum values for each attribute on a specific day. I can set up a data source that adds a generic date filter to its SQL query, but how do I tell the data source the specific date it needs to use?

回答1:

You really need to implement the JRQueryExecuter interface as well. Implementations of the interface are responsible for converting the query into a JRDataSource.