使用SUM方法时Jasper编译器错误 [英] Jasper compiler error when using SUM method

查看:151
本文介绍了使用SUM方法时Jasper编译器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表的单元格中使用Jasper内置的SUM函数. 它应该对其他单元格的内容求和(在示例中,我使用的是一个单元格,但是添加多个单元格的输出几乎相同).

I'm using the Jasper built-in SUM function in a cell of a table. It should sum the content of other cells (in the example I'm using a single cell, but the output is pretty much the same adding multiple cells).

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>

在Jasper Studio中可以正常工作,但是当我尝试使用maven插件或JasperCompileManager编译报告时,它将返回这些错误

In Jasper Studio is working correctly, but when I try to compile the report using maven plugin or using the JasperCompileManager it returns these errors

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),但结果是相同的.

I upgraded to latest Jasper version (5.5.0) but the result is the same.

推荐答案

来自[jaspersoft download] [1]

From [jaspersoft download][1]

[1]: http://jaspersoft.artifactoryonline.com/jaspersoft/jr-ce-releases/net/sf/jasperreports/jasperreports-functions/5.5.0/下载jasperreports-functions-5.5.0.jar并放置它放在您的课​​程路径中.

[1]: http://jaspersoft.artifactoryonline.com/jaspersoft/jr-ce-releases/net/sf/jasperreports/jasperreports-functions/5.5.0/ download the jasperreports-functions-5.5.0.jar and place it in your class path.

这篇关于使用SUM方法时Jasper编译器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆