Jasper Reports/ iReports – multiply problem


I am new to Jasper Reports and I am using a tool called iReports. For the most part my reports have gone pretty well but I am having an issue multiplying 2 fields. Here is what I have.

I have a variable called $V{sum}. I have a filed called $F{haulPercentage}. Both of these fields are type double and I am trying to multiple them.

Here is my textfield expression.

new Double( $V{sum} * $F{haulPercentage} )

but iReports is giving me a compile error saying:

The operator * is undefined for the argument type(s) java.lang.Double, java.lang.Double

Can anyone help me figure out how to complete this expression?


I got it to work…

I created a variable and used this expression:

new Double( $V{sum}.doubleValue() * $F{haulPercentage}.doubleValue() )

as you explained solution i tried it but i still getting an error, i want no know few things from you, i.e

when we create a new variable it is asking for the Calculation type what we have to give there , what i wanted is i wil be having a filed say total
$F{total } i want to find some percent of its may be 10% so how this should be achived, i was trying this with the variable is it correct, please guide me am also new to the Reports now learning it

Thank you,
Manu D G

I have nothing set as my calculation type.

I have the Reset type set to Group and then I selected the group I created for the report.

Yes, I would do this as a variable. Maybe something like…

new Double( $F{percent}.doubleValue() * $F{total}.doubleValue() )

then in your Java entity that you build to pass to the Jasper report… set $F{percent} = to .10

I am not 100% sure this will work but it is worth a try.