javapedant Posted November 10, 2009 Share Posted November 10, 2009 HiI have a collection that is to be passed to the report for displaying.When I pass the collection through JRMapCollectionDataSource, the entire report is being generated for each row of the collection.But I want to display all the rows in the same area .I'm sorry if my english is poor. But please go through the attached files and i'm sure u'll understand what i mean. Attached are my files java file - GenerateReports.java JRXML - FlightReport.jrxml PDF report i'm able to generate currently : FlightReport.pdf My required output : show.bmp ( which i'm desperately in need of ) Please help me with a possible solution. Thanks in Advance Post Edited by javapedant at 11/10/2009 21:38Post Edited by javapedant at 11/10/2009 21:38Post Edited by javapedant at 11/11/2009 22:53 Link to comment Share on other sites More sharing options...
cn73 Posted November 11, 2009 Share Posted November 11, 2009 It's not the "right" way to use jasperreports... each element of a colelction corresponds to a row in the report... hovewer you can can pass a string field like this (your filed has expression $F{something} ) Code: Post Edited by cn73 at 11/11/2009 14:59 Link to comment Share on other sites More sharing options...
javapedant Posted November 12, 2009 Author Share Posted November 12, 2009 Thanks for the reply.SO do you mean need to convert all my fields in a row to string and pass ?? Link to comment Share on other sites More sharing options...
cn73 Posted November 13, 2009 Share Posted November 13, 2009 Only if you don't understand subreport (and Collection) concepts... Link to comment Share on other sites More sharing options...
javapedant Posted November 13, 2009 Author Share Posted November 13, 2009 Thank you for your reply.I started making a subreport for displaying my collection.But i'm not sure wether to pass my collection through the main rreport datasource.DO I actually need to create a new datasource for subreport?? Link to comment Share on other sites More sharing options...
cn73 Posted November 13, 2009 Share Posted November 13, 2009 your bean must be something like this:in the report you have 3 filed:flightNumberflightNameflightDescriptionthen pass at your report a Colection<FlightBean > ...Code:import java.io.Serializable;public class FlightBean implements Serializable { public String getFlightNumber() { return ... } public String getFlightName() { return ... } public String getFlightDescription() { return ... }} Link to comment Share on other sites More sharing options...
javapedant Posted November 13, 2009 Author Share Posted November 13, 2009 Ohh..Thanks for the reply agn.Ok. I'm doing the same thing.But do I need to pass this as a datasource to my main reoprt or the subreport. And if it is to the main report..How about the other collections..do i need to have everything into the same bean ?Post Edited by javapedant at 11/13/2009 15:16 Link to comment Share on other sites More sharing options...
cn73 Posted November 13, 2009 Share Posted November 13, 2009 sorry, yesterday I did not understand ... No subreport is required, this report is very easy: see the code...I've used the same method name as you in your code... that's ok? ;) Code: Post Edited by cn73 at 13/11/2009 16:22 Link to comment Share on other sites More sharing options...
javapedant Posted November 13, 2009 Author Share Posted November 13, 2009 I found a similar example as you have told above. When I try to implement the o/p is still the same. A new page is being created for each row in the data source. And so 4 pages are being created. I understand it should be in 1 page..But unable to figure why multiple pages are being created. Any idea ?? Link to comment Share on other sites More sharing options...
cn73 Posted November 13, 2009 Share Posted November 13, 2009 Reduce the heigth of the "detail" band!! And use column header band for title! see the attachment! Link to comment Share on other sites More sharing options...
javapedant Posted November 13, 2009 Author Share Posted November 13, 2009 Thanks..It works :) Link to comment Share on other sites More sharing options...
cn73 Posted November 16, 2009 Share Posted November 16, 2009 ;) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now