printing strangely

0
Hi,

I have 2 subreports inside the group_req_resp in the master report. I need to add the values returned
from the subreports.

Iteration 1:
1st subreport returns 35 and 2nd returns 85 and the master report can sum them up and display as 120.

Iteration 2:
1st subreport returns 70 and 2nd subreport returns 286 and the master report displays the sum as 356.

Iteration 3:
1st subreport returns 0 and the 2nd subreport returns 4 but the master report cannot add them and shows as 0.

The variable that is used to display the sum value is <sum_tot>. This adds the two variables <sum_sub1> and <sum_sub2>.
<sum_sub1> holds the value returned by subreport1 and similarly the <sum_sub2> holds the value from subreport2.
I created an expression for <sum_tot> variable to check
what exactly is happening:

($V{sum_sub1}.intValue() == 0)
?
( ($V{sum_sub2}.intValue() == 0)
?
new BigDecimal(9)
:
new BigDecimal(99) )
:
new BigDecimal(999)

<sum_tot> prints 999 when both <sum_sub1> and <sum_sub2> are not zero. For the last iteration its printing 9 (i.e., when
<sum_sub1> = 0 and <sum_sub2> = 4.) For some reason, <sum_sub2> is getting equal to zero.

<sum_sub1>:
Calculation: System
Expression: $V{sum_sub1}
Reset Type: Group
Reset Group: GROUP_REQ_RESP

<sum_sub2>:
Calculation: System
Expression: $V{sum_sub2}
Reset Type: Group
Reset Group: GROUP_REQ_RESP

<sum_tot>:
Calculation: System
Expression: new BigDecimal($V{sum_sub1}).add(new BigDecimal($V{sum_sub2}))
Reset Type:None

Why is it strange?

Please help me.

Thanks.

Post edited by: jackdawson, at: 2008/02/29 17:54
Post edited by: jackdawson, at: 2008/02/29 17:59
jackdawson's picture
Joined: Feb 7 2008 - 4:38am
Last seen: 12 years 8 months ago

1 Answer:

0
I solved it.

I changed the "calculation" property of the <sum_tot> from "System" to "Nothing" and modified the "expression" property.

It worked.

Thanks JasperForge.
jackdawson's picture
Joined: Feb 7 2008 - 4:38am
Last seen: 12 years 8 months ago
Feedback
randomness