how to add new data to an existing report using .jrxml and java only

hello to all

i am currently working on jasper report .i am using ireport 5.5 to  design template of the report and java bean datasource to execute query from

java class file to poplulate the table data in template.The format of the exported report is .xlsx and it is working fine . 

Question: how to add new data to the report side by side to the old data  . I mean , i want to append the new values to the report .

PS- i am preparing daily report for a particular service used by customers . so i need each day  data adjacent to old data of the customer .

i hope  i made my query clear , if not please ask me if there is any doubt.

thanking you all in anticipation and thanking the people responsible to keep this site up for people like us.

 

 

incusor's picture
Joined: Mar 3 2014 - 9:32am
Last seen: 9 years 2 months ago

1 Answer:

I think that your best approach will be to using subreports. The main report queries the new data and the subreport queries the old data. That way you can have both in the same report unit.

The other option will be to use 2 table components. Table components will work with report datasets. Each dataset can have it's own query (in your case can call different beans) then each table will be driven by it's own dataset. Also JR allows you to pass parameters from the main report to the dataset.

marianol's picture
16194
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 7 months ago

thank you for providing me the solutions . so from this i understand that there is no option like appending new data sets with the old data sets in the report as we do in file handling cases in java .any way sub report is not an option for me .

incusor - 9 years 2 months ago

I'm not sure if it will help. But since you need to extend the datasource and you are using JR directly from Java why don't you do it at the JRDatasource level before filling in the report? Is there any reason you need to do this during report execution?

Another thing that i'm thinking now is to report out of a java bean look at this: http://stackoverflow.com/questions/9038887/one-object-java-bean-as-data-...

marianol - 9 years 2 months ago

how to do it at JRDatasource level ? each time report is created the previous dataset is deleted and the new dataset is filled in the report . I am looking for option like appending in file handling in java . If it can be done at JRDatasource level then please explain it how to do it .

incusor - 9 years 2 months ago
Feedback