How to calculate division and multiply in Jasper report?
16,047
here is the solution
how to use divide() method in jasper reports?
And note to check for nullity by assigning the initial value to 0.
${total_answer}.divide( ${total_max_score} )
and you can do the same for multiplication using .multiply()
Related videos on Youtube
Author by
Naim Nsco
Updated on June 04, 2022Comments
-
Naim Nsco almost 2 years
I have problem when I try to calculate an expression in Jasper. The error message show after I run the report.
Error filling print... Error evaluating expression : Source text : new Integer(($F{total_answer}.intValue()) / ($F{total_max_score}.intValue()*100)) Can't find the translation for key = time_picker: using default (Time) Can't find the translation for key = time_picker: using default (Time) For input string: "" For input string: "" java.lang.ArithmeticException: / by zero
This my code:
new Integer(($F{total_answer}.intValue()) / ($F{total_max_score}.intValue()*100))
Anyone know about this?
-
Alex K almost 12 yearsDid you check the
$F{total_max_score}
for 0 and null value? -
Diego Urenia almost 12 yearsSeems like some expression that you are using is being divided by zero. Are you using only this one?
-