how to get this


i would like to use the search-function of this forum, but i dont know what to search for.

well, i want to have a report like this:

<br />
articlenumber      articlename<br />
------------------------  <br />
1111               book<br />
1111               book<br />
1111               book    <br />
2222               tshirt<br />
2222               tshirt<br />
3333               pencil<br />
3333               pencil<br />
</td></tr></tbody></table><br />
<br />
<br />
<br />
This is no problem, i managed to get it shown on my report :-)<br />
But after this table, this should also be seen on the report and which makes me alot of problems:<br />
<table cellpadding="0" cellspacing="0" align="center" width="525" bgcolor="#cccccc"><tr><td><br />
1111               book      3 parts<br />
2222               thsirt    2 parts<br />
3333               pencil    2 parts<br />
</td></tr></table><br />
<br />
How would you make this second part of the report? i have no idea<br />
<br />
thanks for each answer<br>Post edited by: hansolohansolo, at: 2006/09/28 07:11
hansolohansolo's picture
Joined: Sep 27 2006 - 4:59pm
Last seen: 17 years 2 days ago

1 Answer:


There are two ways to do it:

1) Use two subreports for the two parts of you main report. Both subreport will use the same data source (or the same query), but the second one will have a group by item code and no detail section. You'll display the information in that group footer where you can have the MyGroup_COUNT built-in variable to give you the number of items in the current group.

2) Use a scriptlet to aggregate the item totals during iteration throught the items and then use a subreport to display that aggregated data in the summary of the main report. You could wrap your scriptlet aggregated data into a custom implementation of the JRDataSource interface or you could rather use a bean data source implementation that comes with JR, to feed the summary subreport with the aggregated data.

I hope this helps.
teodord's picture
Joined: Jun 30 2006 - 9:00am
Last seen: 32 min 58 sec ago