- I have a report in Crystal Reports 2008.
- The report uses a few different sub-reports.
- The report links the sub-reports to the main report by passing the main report parameter to the sub-report parameter.
- When calculating totals, it works correctly if I pass in a single parameter value to the main report.
- However, if I pass in multiple values for a parameter to the main report (think multiple work order numbers for a WONUM parameter), the sub-report calculates totals for all the fields
At first, it seemed like the issue was due to me not resetting the sub-report total calculations on each page. But, I knew that I was doing this, and doing it correctly according to multiple reference points.
However, the issue (and thus, the solution) was simpler.
Because I was passing the main report parameter to the sub-report, Crystal was passing all parameters that I passed into the main report into the sub-report, so the sub-report was being told to calculate across all those values each time.
Instead, I changed the link to the sub-report parameter. Instead of passing it the main report’s parameter, I passed it the main report field that contained the work order number, thus assuring that it would only receive that one work order as a parameter.
See the StackOverflow discussion for more references and comments.