我在Jasper中有一个报告,我想打印用户名字段的不同值(查询返回所需的输出 - 无用户名重复值),但报告正在打印重复的用户名:
当前输出
Username|OTHER VALUE
1 | A
2 | B
3 | C
2 | B
5 | E
期望的输出:
Username|OTHER VALUE
1 | A
2 | B
3 | C
4 | D
5 | E
这是来自jrxml文件的一些相关xml:
<crosstab>
<rowGroup name="username" width="80" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{username}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" mode="Transparent" x="0" y="0" width="80" height="12" uuid="7b266b77-130f-4834-ae30-3c1ae25db54b"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$V{username}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
</rowGroup>
<columnGroup name="conversion" height="36" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{othervalue}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="5" width="90" height="31" uuid="e8d6815d-12bb-4806-a441-9cf86243d27e"/>
<textElement verticalAlignment="Top">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{othervalue}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
</crosstab>
任何帮助?