我在表格的單元格中使用Jasper內置的SUM函數。 它應該總結其他單元格的內容(在我使用單個單元格的示例中,但輸出與添加多個單元格的內容幾乎相同)。使用SUM方法時的Jasper編譯器錯誤
的JRXML是:
<jr:column width="49" uuid="e6595bc8-b46e-4bbe-85a2-7ea9526fce83">
<property name="local_mesure_unitwidth" value="pixel"/>
<jr:columnHeader style="Table 2_CH" height="20">
<staticText>
<reportElement x="2" y="0" width="47" height="20" uuid="af5e8305-5cdf-41ad-b827-80f0ca14771c"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Nr. Prest.]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 2_TD" height="30">
<textField>
<reportElement x="0" y="0" width="49" height="30" uuid="8cc69012-6972-470a-92f4-e735f8d006d8"/>
<textFieldExpression><![CDATA[SUM($F{1})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
在碧玉工作室工作正常,但是當我嘗試使用Maven插件或使用JasperCompileManager返回這些錯誤編譯報告
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632
value = SUM(((java.lang.Integer)field_j49.getValue())); //$JR_EXPR_ID=41$
<->
2. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632
value = SUM(((java.lang.Integer)field_j49.getOldValue())); //$JR_EXPR_ID=41$
<->
3. The method SUM(Integer) is undefined for the type report1_dataset1_1389172627824_411632
value = SUM(((java.lang.Integer)field_j49.getValue())); //$JR_EXPR_ID=41$
<->
3 errors
net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:204)
net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:241)
我升級到最新的Jasper版本(5.5.0),但結果是一樣的。
你能告訴我你的表情嗎 –
你說得對。我已將jrxml添加到問題中。問題出在'<![CDATA [SUM($ F {1})]]> textFieldExpression>' –
Ste
這是什麼?<![CDATA [SUM($ F {1})]]> .......... 1不是字段名稱 –