iReport中每个组的新页面 [英] New page for every group in iReport
问题描述
我正在使用iReport 5.6.0,我想为每个组创建一个新页面.
例如,我有表people_i_know
:
Id| Name | State
1 | Tom | friends
2 | Jim | friends
3 | Mike | enemy
4 | Alex | friends
5 | Julie| enemy
我的SQL应该是这样的:
SELECT Id,Name,State FROM people_i_know GROUP BY State;
在此示例中,iReport应该给我两个页面,其详细信息带如下:
这应该在第1页上.
1 | Tom | friends
2 | Jim | friends
4 | Alex | friends
这应该在第2页上.
3 | Mike | enemy
5 | Julie| enemy
我如何使iReport生成类似这样的内容?
您无需对查询进行分组,只需对它们进行排序
SELECT Id,Name,State FROM people_i_know State ORDER BY State;
在jrxml中
您将有一个相对于State
列的字段
<field name="State" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
在State
上通过属性isStartNewPage="true"
创建组
<group name="State" isStartNewPage="true">
<groupExpression><![CDATA[$F{State}]]></groupExpression>
</group>
现在将您要显示的字段放在detail
区域
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
这篇关于iReport中每个组的新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!