Jump to content
Changes to the Jaspersoft community edition download ×

How to report on nested bean collection


telcik

Recommended Posts

To whom it may concern,

 

I need to report on a nested bean collection in my report, which is essentially a standard letter with a table of data.

 

The following outline resembles my letter:

 

<<START TEMPLATE>>

NAME

ADDRESS

DATE

 

SALUTATION

 

LETTER BODY

 

TABLE DATA

 

SIGNATURE

<<END TEMPLATE>>

 

My Letter body is represented as a Java bean and contains a List of Java beans representing the table data.

 

The Letter and Table beans are fairly standard.

 

eg.

 

import java.util.List;

public class Letter {

private String name;

private Address address;

private List tableList;

public String getName() {};

public void setName( String newName ) {};

public Address getAddress() {};

public void setAddress( Address newAddress ) {};

public List getTable() {}; //List of Table objects

public void setTable( List newTable ) {};

}

 

public class Table {

private Date issueDate;

private String description;

public Date getIssueDate() {};

public void setIssueDate() {}

public void setDescription( newDescription ) {}

public String getDescription() {};

}

 

I am using a JRBeanCollectionDataSource as my data source for the jasper report template.

 

While I can query "fields" from the Letter using bean access notation (eg. letter.name), I cannot query fields from the beans in the nested Table List using bean access notation (eg. letter.table[index]).

 

I may be missing something here regarding how jasper works with (bean) data sources.

 

Am I able to query a bean and nested List using the same bean collection data source ? Or, should I be using a master report template for the letter body and a sub-report template for the table data, each with their own bean data source ?

 

I have yet to find any examples (with the jasper distribution) or elsewhere that cover this problem.

 

I think my query is loosely related to the previous posting in this forum, "How to link each subreport with diff datasrc" at

"http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=9&id=393#393"

 

Assistance most welcome.

 

 

Thanks.

 

Tim

Link to comment
Share on other sites

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

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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