Jump to content
We've recently updated our Privacy Statement, available here ×

Dynamically adding sub-reports


n00b

Recommended Posts

Hello,

I am using jasper reports for some time and it has been a smooth experience so far with charts and tables.

Now, My current situation is like this:

my report (lets call it experiment report) contains the following things:

  • a bar chart (barchart.csv)
  • a timeline chart (timechart.csv)
  • a table (table.csv)

I have multiple csv files which i use as a data source for each of the above elements.

Now, my current requirement is that i create multiple instances of the same report above mentioned. i.e. There will be a master report which will contain the above experiment report as a subreport and there can be N number of experiments.

So, the final report should have the following things:

  • Experiment1
    • a bar chart (barchart-e1.csv)
    • a timeline chart (timechart-e1.csv)
    • a table (table-e1.csv)
  • Experiment2
    • a bar chart (barchart-e2.csv)
    • a timeline chart (timechart-e2.csv)
    • a table (table-e2.csv)

And there can be N number of experiments. (it will be decided on run time)

I will have different set of csv files for each elements. but my question is how do i include multiple subreports at runtime because the template (jrxml file) is created only once.

Is it possible through jasper report APIs? or any other way?

-n00b

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Well, I am not an expert in this matter, but I am afraid it is not possible with jasperreports API.

The solution should be possible to obtain with some external XML templating tool, like Velocity.

There is a great article (accessible from jasperreports Docs) about that:

http://www.ibm.com/developerworks/websphere/library/techarticles/0505_olivieri/0505_olivieri.html

 

BTW: How are planing on generating multiple cascade styles for your report (just curiosity :) )



Post Edited by pawel_r at 09/04/2009 11:21
Link to comment
Share on other sites

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