I'm trying to work out how best to do reports with a chart then a table representing the same dataset. I need to overcome the positioning of the summary is at the bottom, so intend to use subreports and table-subreports. I am experimenting with two tables and a chart in one detail band.
If I set the datasourceexpression
for to $P{REPORT_DATA_SOURCE}
only the chart displays data (presumably the first subreport type item) and the tables are empty. Seems the data can be consumed only once?
If I use a Dataset to query the database it works however it executes the Query three times, once for each table/chart. That will be a massive overhead.
Obviously I am not doing this right but I cannot find any examples of using the same dataset more than once.
With a SQL connection, you can just pass a Connection Expression like $P{REPORT_CONNECTION} . Then the subreport has its own SQL query. In your case you want to pass the actual data. Depending on the details, it might be as simple as just defining a Parameter Map Expression like $P{REPORT_PARAMETERS_MAP} .
In JRBeanCollectionDataSource(listjrbean) you should add collection of objects/beans. You need to verify bean should have getter and setter for empCode. For Ex class EmpClass { private String empCode; private String empName; public String getEmpCode() { return empCode; } public void setEmpCode(String empCode) { this.
$R{} is used for localization to replace value with those from the resource file. http://community.jaspersoft.com/questions/538008/rresource. 140055.
There is no simple answer so I have raised a feature request http://jasperforge.org/projects/jasperreports/tracker/view.php?id=5487
The suggested workarounds were:
Thanks to sanda aka shertage on the jasperforge forum for these suggestions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With