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

1 to n reports in a single report.


bobz28

Recommended Posts

Hi All,

I am trying to create a template for a report that can be from 1 to many (around 10 reports) in one report output. Depending on the user input (~10 drop down lists and each list if selected will eventually populate a report). Ex. if user select inputs from 5 drop down lists then I will have to generate 5 reports, one after another, if they select 10 then create 10... What is a best way to accomplishing this?

Thanks-

Bob

 

 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Please find the below code. One report corresponds to the one jasper file. Appending one report with another can happen with the code given below. It will be an as-is append.

Code:
     for( int i = 0; i < listOfInputjasperpath.size(); i++ ) { try {        JasperPrint jasperPrint = JasperFillManager.fillReport(          listOfInputjasperpath.get( i ) + ".jasper", params );        listOfJasperPrint.add( jasperPrint );      } catch( JRException e ) {        throw new RuntimeException( "Exception related to Jasper Filling Data " + e );      }
Link to comment
Share on other sites

It will stll with the same template since jasperPrint is the one which will be different for different reports in your case. Just that you have to provide different datasources to the same jasper file to get the jasper print object to finally append them.

Link to comment
Share on other sites

Hi,

Can somebody help... How can I append one report after another in Spring Hibernate framework?

Here is what is look like in the controller:
Map<?,?> model = new HashMap<?,?>();
List<?> report = getReport();
String[] fields = new String[] {"a", "b", "c"};
HibernateDataSource ds = new HibernateDataSource(report, fileds);

model.put("title", title);
model.put("dataSource", ds);
...
return model;

Thanks a lot.



Post Edited by bobz28 at 08/25/2010 14:43
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...