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

Displaying Rows from a collection ?? HELP


javapedant

Recommended Posts

Hi

I 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:38



Post Edited by javapedant at 11/10/2009 21:38



Post Edited by javapedant at 11/11/2009 22:53
Link to comment
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

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

your bean must be something like this:

in the report you have 3 filed:

flightNumber

flightName

flightDescription

then 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

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

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

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