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
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
2 Answers:
Posted on September 22, 2006 at 6:56am
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 |