Jump to content

Subreport required hierarchical custom datasource


Recommended Posts


I have a hierarchical collection of data in a custom datasource -- a list of Employees, where for each employee, there is a list of EmployeeTasks.


Whereby, when the report runs, I would like to see for each employee, a display of 0-n rows of EmployeeTasks.



Am I required to define a subreport within a master in order to display my data? Might I simply define a subdataset? If this is possible, how do I make this work?




Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

This is unfortunate. Why do I need to create a subreport (another file to manage) just to iterate and render detail info within my report? I wish the Jasper engine would allow a SINGLE jrxml template to effectively render both a master "list" of data and an indefinite number of detail "lists" of data.


This would lessen the work (and pain) required by application developers like myself in order to use the tool you are supporting in the marketplace.


Nonetheless, thanks for sharing your thoughts Lucian!



Link to comment
Share on other sites

Or here's another solution:

If it's decided that subreport jrxml templates are required, why can't Jasper compile all templates into a single .jasper file. Again this with reduce the runtime coding overhead (for precompiled reports) I have as an application developer.




Link to comment
Share on other sites

Currently in JR a subreport is simply an independent report which is embedded into another report. This paradigm was chosen when subreport were introduced in the engine so that the maximum amount of existing logic and code would be reused.


Binding a report to a subreport element is only done at run/fill time. This allows full flexibility, although in most of the cases the flexibility is not required and the subreports could be statically resolved at compile time.


The features you suggest would, indeed, ease the resource management and deployment effort. The feature request list is always open:






Link to comment
Share on other sites

kjhuebner, lucianc

Although I am new to this how about this solution which best fits your need.

Y did Lucianc jump to subreport or subdataset?


Considering you fetch the data in one go as a array list of array list in a single query with the data in certain columns (like employer, employee) repeating more (Sub reports bring in multiple queries--which affect performance)


Then you can use Grouping feature of the Jasper (on employer, employee) and make it display as required


I believe the only problem that can occur is if data it contains history for employee task to be displayed as in a crosstab format which can fail.


Lucianc can comment more

Link to comment
Share on other sites

  • 4 years 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...