telcik
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by telcik
-
-
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
question about subreport sample
in Products
Posted
jo_atman wrote:
I'm looking at the samples, and i was checking out the subreports sample, and either i don't understand how it works, or something is missing or both.
The zip file contained the following files:
MasterReport.html
MasterReport.jrxml
MasterReport.pdf
Shouldn't there be a jrxml or something for the subreport part? basically i can't figure out where the subreport text is coming from. e.g.
in the left column it says, "Products ordered by people in <City>", and on the right side it says, "Addresses in <city>", but i don't see this text in the MasterReport.jrxml.
Thanks,
Nilesh
Nilesh,
for the "products", the text "Products ordered by people in <City>" is coming from "MasterReport.jrxml" (line # 195) and "ProductReport.jrxml". A similar situation holds for the "addresses".
Tim
the text is coming from the subreports,