Jump to content

Using an ArrayList as a datasource


2006 IR Open Dicussion

Recommended Posts

By: cyclistca - cyclistca

Using an ArrayList as a datasource

2006-03-28 15:17

I want use an ArrayList as the datasource in the subreport of my main report.

 

I've defined the list as one of the items in the HashMap that I am passing to the report. I've then defined a parameter in the report as a java.util.list.

 

In the main report how do I define the list as the datasource for my subreport? How do I set up this data source in the subreport?

 

In the subreport how do I iterate through the objects in my list?

 

 

 

 

By: cyclistca - cyclistca

RE: Using an ArrayList as a datasource

2006-03-29 16:40

Ok so I've created a JRDataSource to read the items from my list. Now I'm stuck.

 

I still can not figure out how to assign the class as the datasource for my subreport?

 

 

 

 

By: TBG - thebiggunner

RE: Using an ArrayList as a datasource

2006-03-29 23:26

Hi and sorry for my bad english.:)

I had the same problem. The easiest way for me was to create a TableModel from the ArrayList and passed to the report.

1. First, you have to create the TableModel class, as usually.

2. Create the report. Create fields for the reports. The field names must be equal as in the TableModel.

Design the report.

3. After passing the TableModel to the report, it will use the TableModel as a DataSource.:)

 

Need sample?

 

Byz.

Link to comment
Share on other sites

  • 2 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

I would iterate from a list passed to the report and print each object in that list. Maybe this is not the better way, can you post some sample about TableModel implementation? How report fields are matched with it?
 

Thank you.

Mesk

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