I'm using iReport 5.6.0 and i want to create new page for each group.
For example i have table people_i_know:
Id| Name | State
1 | Tom | friends
2 | Jim | friends
3 | Mike | enemy
4 | Alex | friends
5 | Julie| enemy
My SQL should be like this:
SELECT Id,Name,State FROM people_i_know GROUP BY State;
And in this example iReport should give me two pages with detail band like this:
This should be on page 1.
1 | Tom | friends
2 | Jim | friends
4 | Alex | friends
And this should be on page 2.
3 | Mike | enemy
5 | Julie| enemy
How do i make that iReport make something like this?
You do not need to group in query, just order them
SELECT Id,Name,State FROM people_i_know State ORDER BY State;
in jrxml
you will have a field relative to the State column
<field name="State" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
create a group on State with attribute isStartNewPage="true"
<group name="State" isStartNewPage="true">
<groupExpression><![CDATA[$F{State}]]></groupExpression>
</group>
and now just put the fields you like to display in the detail band
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With