Jump to content
Changes to the Jaspersoft community edition download ×

How to Multiply two Fields in iReport???

Recommended Posts

By: Deepa Kapadia - deepa_kapadia

How to Multiply two Fields in iReport???

2006-02-01 21:18



I have one report, which has two Fields.

One has integer value & one has double value.

I want to calculate those Fields in another variable.


But I got errors of Jasper.

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The operator * is undefined for the argument type(s) Integer, Double value = (java.lang.Double)(((java.lang.Integer)field_quantity.getValue())*((java.lang.Double)field_priceeach.getValue())); <--------------------------------------------------------------------------------------------->


How to multiply two fields in Jasper?


Plz help me out.



Deepa Kapadia








By: Johnny A - sykosity

RE: How to Multiply two Fields in iReport???

2006-02-02 14:55

There seems to be some confusion between java objects and java primitives.


You're trying to apply the multiply operation (*) to two java objects... Integer and Double. You have to make your expressions the same as you would if you were wanting to multiply an Integer and a Double in a java application.


Instead of having an expression like:

$F{quantity} * $F{priceeach}


try something like:

new Double( $F{quantity}.intValue() * $F{priceeach}.doubleValue() )





By: Deepa Kapadia - deepa_kapadia

RE: How to Multiply two Fields in iReport???

2006-02-03 21:19

Hi Johnny,


Thx for ur reply.

My prob is solved, it works fine.


Thx again.


-- Deepa Kapadia

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...