我想在jasper报告中添加一个pivot(交叉表)。当我添加数据透视表时,我在下载文件时出错。我尝试调试运行查询,我没有错误,我也尝试调试,在视图上显示参数,参数显示没有错误,我也尝试显示查询的结果,和数据显示出来。
那么我的问题是什么?以及如何修复我的代码?
详情带
<detail>
<band height="230">
<crosstab>
<reportElement x="167" y="30" width="200" height="200" uuid="b1977adf-e860-43cf-8940-fe4862f16621"/>
<rowGroup name="KOMPETENSI1" width="60">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{KOMPETENSI}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="72845a66-f743-4f35-8091-02df93de67d0"/>
<textFieldExpression><![CDATA[$V{KOMPETENSI1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="5792f3fa-1bb5-4134-91e1-b51918c05ec0"/>
<text><![CDATA[Total KOMPETENSI1]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="TAHUN1" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{TAHUN}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="fd89bbdf-eb6c-4c75-ab2c-9414ccd88458"/>
<textFieldExpression><![CDATA[$V{TAHUN1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="2d91db64-a9d7-43d3-b1c5-4c61412de5a1"/>
<text><![CDATA[Total TAHUN1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="JOB1" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{JOB}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="60" height="20" uuid="6adc10a6-8c28-4d17-bc6d-32727f7a8805"/>
<textFieldExpression><![CDATA[$V{JOB1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<staticText>
<reportElement x="0" y="0" width="-2147483648" height="-2147483648" uuid="fe8d03a8-5308-4845-b868-2b4cec45c2b5"/>
<text><![CDATA[Total JOB1]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="LEVEL_JOB_MEASURE1" class="java.lang.String">
<measureExpression><![CDATA[$F{LEVEL_JOB}]]></measureExpression>
</measure>
<measure name="LEVEL_KOMPETENSI_MEASURE1" class="java.lang.String">
<measureExpression><![CDATA[$F{LEVEL_KOMPETENSI}]]></measureExpression>
</measure>
<crosstabCell width="60" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="0e4ec703-4f2c-4389-bb9b-02a7f8df230e"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="8f49c8dc-e172-4407-ba54-6aa077591235"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="TAHUN1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="78be64d3-2d78-411f-9d60-3b545311e376"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="47ac3c87-fee5-4e99-bade-9304180bdc2c"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" columnTotalGroup="JOB1">
<cellContents mode="Opaque" style="Crosstab_CG">
<textField>
<reportElement x="0" y="0" width="60" height="10" uuid="94604b9b-36f7-4572-8c24-c48a538503b8"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" uuid="8f2f6f73-049e-45ae-9d5b-fe55abad0c24"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="41785b14-fc8f-4c85-928b-0df8555ffcb5"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="0cfec42f-0f33-46ff-9367-2c0c4978744c"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="TAHUN1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="1081fcf5-f921-47a0-89c0-923b9be4fd73"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="0215fe30-2917-40a7-84d1-2cdac6216373"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="KOMPETENSI1" columnTotalGroup="JOB1">
<cellContents mode="Opaque" style="Crosstab_CT">
<textField>
<reportElement x="0" y="0" width="60" height="10" forecolor="#FFFFFF" uuid="ba2855de-e2bf-4354-9c4f-67105912b4d7"/>
<textFieldExpression><![CDATA[$V{LEVEL_JOB_MEASURE1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="10" width="60" height="10" forecolor="#FFFFFF" uuid="202c0fa6-308b-4a7e-9656-33eea6859d89"/>
<textFieldExpression><![CDATA[$V{LEVEL_KOMPETENSI_MEASURE1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</detail>
参数定义:
<parameter name="pPersonId" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="npp" class="java.lang.String"/>
查询:
<queryString>
<![CDATA[select CASE WHEN (JENJAB like 'SEVP') THEN '4'
WHEN (JENJAB like 'EVP') THEN '4' WHEN (JENJAB like 'SVP') THEN '4'
WHEN (JENJAB like 'SVP') THEN '4' WHEN (JENJAB like 'AVP') THEN '3'
WHEN (JENJAB like 'AVP') THEN '2' END AS LEVEL_JOB, kompetensi,
level_kompetensi, tahun, job from OL_ASSESSMENT_RESULT
where tahun in (select tahun from ( select distinct tahun
from OL_ASSESSMENT_RESULT order by tahun desc)
where ROWNUM <=3 ) and npp = $P{npp}]]>
</queryString>
字段声明:
<field name="KOMPETENSI" class="java.lang.String"/>
<field name="LEVEL_JOB" class="java.lang.String"/>
<field name="LEVEL_KOMPETENSI" class="java.lang.String"/>
<field name="TAHUN" class="java.lang.String"/>
<field name="JOB" class="java.lang.String"/>
错误:
JRRuntimeException:错误递增交叉表数据集
引起:JRException:交叉表数据已经存在 加工
答案 0 :(得分:3)
您的问题是,您已将crosstab
转移到detail
频段,并且正在使用crosstab
的报告数据源。
因此,在数据源中的每条记录上,报表都会迭代详细信息区域,从而创建使用相同数据源的新交叉表。这不起作用并且给你错误
JRException:已经处理了交叉表数据
<强>解决方案强>
将交叉表完全移至summary
或title
个频段
删除细节带。
为交叉表
subDataset
醇>