Summation Problem

I am reading in an SQL query from a jdbc connection.

I need to sum integers in a field column for a subtotal, but there are a couple of rows that I need to exclude from the summation. These rows can be identified by their integer values. I haven't been able to figure out how to do it. Is it possible?

Any suggestions would be appreciated. I am new to Jasper and iReport.
Post edited by: jgamble, at: 2006/09/22 18:54
jgamble's picture
Joined: Sep 21 2006 - 8:57am
Last seen: 4 years 8 months ago

2 Answers:

You could do
Code:
<variable name="sum" class="java.lang.Integer" calculation="Sum"><br />
  <variableExpression>..condition.. ? $F{field} : new Integer(0)</variableExpression><br />
</variable></td></tr></tbody></table><br />
<br />
You can also use null instead of new Integer(0).<br />
<br />
HTH,<br />
Lucian
lucianc's picture
77046
Joined: Jul 17 2006 - 1:10am
Last seen: 1 hour 9 min ago
Thank you. That did the trick!
:)
jgamble's picture
Joined: Sep 21 2006 - 8:57am
Last seen: 4 years 8 months ago
Feedback