开发者

Create SubReports in Jasper Report using Java

I have two Collections as below

开发者_Go百科Customer

cid : 1 | name: John ;

cid : 2 | name: Joseph;

Order

cid : 1 | itemNo: 1 itemName: Mobile;

cid : 1 | itemNo: 2 itemName: LapTop;

cid : 2 | itemNo: 1 itemName: iPad;

cid : 2 | itemNo: 2 itemName: iPhone;

cid : 2 | itemNo: 3 itemName: Mobile;

Can anyone please explain how to display the above collections as a report in the below pattern?

cid : 1 | name: John ;

itemNo: 1 itemName: Mobile;

itemNo: 2 itemName: LapTop;

cid : 2 | name: Joseph;

itemNo: 1 itemName: iPad;

itemNo: 2 itemName: iPhone;

itemNo: 3 itemName: Mobile;


I would group them up in the code, and pass the report a collection of bean objects with customers and the items they bought. You can use that bean object to format the report.

The bean would have member variables cid, custName, and a collection of Order objects with the relevant item information. Pass the report a list of those beans, and you should have no problem formatting the report how you want.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜