Divide variables, variable division

0

Hello! Can anyone help me with dividing two variable Totals? I have two variable Totals.  Each Total is the sum of a field in the detail band.  The Totals appear in a group footer.  I would like to divide SUM_Field1 by SUM_Field2.  Any help would be greatly appreciated.  iReport 3.0.0 pro. Thank You, Chris

hgfree's picture
21
Joined: Feb 12 2009 - 12:45pm
Last seen: 5 years 7 months ago

2 Answers:

0

Create a new textfield with a class type Double then add the following in your texfield expression:

new Double($V{SUM_Field2}.doubleValue() == 0 ? 0 : ($V{SUM_Field1}.doubleValue()/$V{SUM_Field2}.doubleValue()))

Hope this helps!

kchaudhry's picture
288
Joined: Apr 9 2007 - 6:10am
Last seen: 7 years 5 months ago
0

You are fantastic!  Thank you so much! Chris

hgfree's picture
21
Joined: Feb 12 2009 - 12:45pm
Last seen: 5 years 7 months ago
Feedback