2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 By: Raju - rajum Sum of return values from subreports 2006-03-08 08:54Hello, My main report contains two subreports (in detail section). Each subreport returns a value. For each row returned in the main sql query, the subreports need to be called. I have two variables (Say x1, y1) with calculation="System" to store the values returned from subreports. I created another variable with calculation="Sum" and variable expression as $V{x1} + $V{y1}. Something seems wrong here. It returns me wrong result. Can anyone help me how do I sum all the return values from subreports? May be a pseudo code can help understand my problem better for each rowi returned in sql query { xi = subreport1(...); yi = subreport2(...); } display ( x1 + y1 + x2 + y2 + .....); Thank you for your time Raju By: Lucian Chirita - lucianc RE: Sum of return values from subreports 2006-03-09 00:36Hello The cause of the miscalculation is that x1 and y1 have their value set in the course of the detail band's printing (as soon as a subreport ends), while the sum variable has its value incremented at the beginning of the detail band printing (at which moment x1 and y1 are not set). The straightforward way to sum values returned from a subreport is to set calculation="Sum" to the returnValue element. You can then simply sum the variables for the two subreports: for each rowi returned in sql query { x += subreport1(...); y += subreport2(...); } display ( x + y ); HTH, Lucian By: Raju - rajum RE: Sum of return values from subreports 2006-03-09 08:40Thank you for the tip. It works just as expected. regards Raju 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