Jasper reports ireport:将变量添加到另一个变量中

Jasper reports ireport:将变量添加到另一个变量中,jasper-reports,ireport,Jasper Reports,Ireport,我有许多来自子报告的变量,定义如下: variable class : integer calculation : system reset type : none increment type : none 我想对其中一些变量求和,例如:$V{nb1}.plus($V{nb2}).plus($V{nb8}) 如果我在文本字段中这样做,效果会很好,但如果我想把它放在变量中(我们称之为sum1)就不行了 这样,我得到了初始值表达式。 如果我将reset type设置为none,则获得null 包

我有许多来自子报告的变量,定义如下:

variable class : integer
calculation : system
reset type : none
increment type : none
我想对其中一些变量求和,例如:
$V{nb1}.plus($V{nb2}).plus($V{nb8})
如果我在文本字段中这样做,效果会很好,但如果我想把它放在变量中(我们称之为sum1)就不行了

这样,我得到了初始值表达式。 如果我将reset type设置为none,则获得null

包含变量sum1的文本字段位于“评估时间:报告”

因此,我的变量sum1是在
nb1
之前计算的,
nb2
nb8
是。我不知道下一步该怎么办


有人能帮我吗?

只有当您打算通过scriptlet直接设置变量值时,才应使用计算类型
system
。在这种情况下,报表引擎将不会对变量表达式求值,这就是您获取null的原因


您应该将计算类型更改为
nothing
,这样只需计算变量表达式即可设置值。您好,谢谢您的帮助,但它不起作用。。。我仍然有我的初始值表达式(我将其设置为零)@user1873571尝试将重置类型从
report
更改为
none
@user1873571 nb1、nb2和nb8的值是什么?它们是整数,在我的示例中是21、87和3。一旦执行子报表,它们就会初始化。一开始,它们什么都不包含。我遇到了同样的问题,你还没有找到解决方案吗?
property of the variable :
variable class : integer
calculation : system
reset type : report
increment type : none