开发者

How to find sum of column in Ireport or jasper report?

开发者 https://www.devze.com 2023-03-18 19:49 出处:网络
I have column in detail band with value $F{thScore}+$F{prScor开发者_如何学Goe} I would like to find the sum of this column in run time . How is this possible in jasper report using Ireport.

I have column in detail band with value

$F{thScore}+$F{prScor开发者_如何学Goe}

I would like to find the sum of this column in run time . How is this possible in jasper report using Ireport. I did it with variable but with no luck.


A variable is defined and

variable expression

to

$F{thScore}+$F{prScore}

and

calculation

to

sum

.It worked for me where $F{thScore},$F{prScore} are fields in detail band.


I had a fields of Integer type and was trying to add the columns . I was not getting any error when the report is previewed but my java application was failing to compile the report and giving the error as

The operator + is undefined for the argument type(s) java.lang.Integer, java.lang.Integer value = (java.lang.Integer)(((java.lang.Integer)field_nBSRptSchm1Col1.getValue())+((java.lang.Integer)field_nBSRptSchm2Col1.getValue())); //$JR_EXPR_ID=8$

then I used the following code to add the columns of Integer type...

new Integer($F{nSchm1Col1}.intValue() + $F{Schm2Col1}.intValue() )

where nSchm1Col1 and Schm2col1 are two fields which I want to add. This one worked for me

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号