开发者

Jasper Sub reports not showing in main report

I am having one jasper report.Inside of the that main report I am adding one sub report.I am passing collections and parameters using java class(Not using sql query directly).It is compiling successfully.

But while running it shows only main report.It is not showing the sub report.And also it is not making any error. It is just giving some empty s开发者_StackOverflowpace for that place. Can any one tell me how to solve this? What are all the rules I have to follow while adding subreport in jasper?


Maybe this will help --> sending a java.util.List parameter:

jasper reports - parameters for ‘in clause’


Supposing you are passing the data to the report as a Java Beans Collection, then i will assume you have one field as a java.util.List which will be used to feed the subreport.

Your original bean will be something like:

public class ParentBean{
     int id;
     String fatherName;
     List<ChildBean> childrenList;

     //setters and getters goes here
}

When calling the Main Report, you should add three fields, the last of them is of type List.

Select the subreport, open the Properties Dialog, in Connection/Data Source Expression, choose Use Data source expression put the following:

new JRBeanCollectionDataSource($F{childrenList})

In your subreport, use the fields in the ChildBean.

NOTE: Dialogs names are from an old iReport version, might changed now.


But have you previewed sub report? May be there will be some errors or filling nothing on the sub report individually...


1.Create DataSet 2.Create List Object 3.Map field with parameter and connection in List Object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜