jackdawson Posted February 29, 2008 Share Posted February 29, 2008 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: SystemExpression: $V{sum_sub1}Reset Type: GroupReset Group: GROUP_REQ_RESP <sum_sub2>:Calculation: SystemExpression: $V{sum_sub2}Reset Type: GroupReset Group: GROUP_REQ_RESP <sum_tot>:Calculation: SystemExpression: 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:54Post edited by: jackdawson, at: 2008/02/29 17:59 Link to comment Share on other sites More sharing options...
jackdawson Posted March 3, 2008 Author Share Posted March 3, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now