开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜