Update: Could It be a different issue?
I'm pretty certain I've taken the correct steps, but what if it's a different issue here?
I have multiple parameters, and it seems like it may be being reset, but then the sub-reports might be calculating across all parameters regardless, so even though it's resetting, it's recalculating across all the multiple work order numbers I've specified in my work order number parameter.
Background
I have a Crystal Report 2008 report with a few sub-reports that share their total values back to the main report for manipulation.
The sub-reports work fine for a single record but don't reset when multiple records are selected, causing them to show the total across all records.
This is an issue with a known solution, but when I attempt to apply it in my report, it doesn't seem to be working as expected.
I'm pretty sure it's an issue either with syntax of the formulas or with the layout of where I'm placing them.
Known Steps to Take
The issue is that Crystal sub-reports don't specifically reset; this is by design.
To force the report to reset, you have to insert a formula in a record-level group (i.e. not report header) before the sub-report is run that sets the shared variable back to zero.
Layout of The Report
- Report Header (suppressed)
- Page Header (basic page information)
- Group Header 1a -- shared variable reset formula
- Group Header 1b -- workorder information
- Details -- Subreport for labor estimates and subreport for materials estimates
- Group Footer 1a -- Formulas displaying the total for both subreports
- Group Footer 1b -- the long description of the workorder (no sub-report)
- Report Footer (suppressed)
- Page Footer (basic page information)
Shared variable creation formula in labor subreport (placed in subreport footer):
WhilePrintingRecords;
Shared CurrencyVar subTotal_LaborCosts;
subTotal_LaborCosts := Sum ({R_PFWR_ESTS_LABBYCODE.TOTALLABORCOSTS});
Shared variable formula in main report (placed in main report, Footer 1a):
WhilePrintingRecords;
Shared CurrencyVar subTotal_LaborCosts;
subTotal_LaborCosts
Shared Variable Reset Formula (placed in main report, group header 1a):
WhilePrintingRecords;
Shared CurrencyVar subTotal_LaborCosts;
subTotal_LaborCosts:=0;
Can anyone see where I'm going wrong? Thanks!