I'm trying to write a manual running total formula in a Subreport to get a Year-to-Date value for each 'Cost Center' that I can pass to the Main report. Below is what I have so far, and it works OK except in the case where the Main Report has a 'Cost Center' value that does not exist on the Subreport... in these cases the formula incorrectly uses the value from the preceding cost center.
numbervar Month1Value;
numbervar Month2Value;
numbervar Month3Value;
numbervar Month4Value;
numbervar Month5Value;
numbervar Month6Value;
numbervar Month7Value;
numbervar Month8Value;
numbervar Month9Value;
numbervar Month10Value;
numbervar Month11Value;
numbervar Month12Value;
if {T_STATISTIC_INPUT.DataSetID} startswith "ACTUAL"
then select {T_STATISTIC_INPUT.MonthNumber}
case 1 : Month1Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 2 : Month2Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 3 : Month3Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 4 : Month4Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 5 : Month5Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 6 : Month6Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 7 : Month7Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 8 : Month8Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 9 : Month9Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 10 : Month10Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 11 : Month11Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 12 : Month12Value := tonumber ({T_STATISTIC_INPUT.MthValue});
whileprintingrecords;
shared numbervar YTD_Actual_Paid_Hours := (Month1Value + Month2Value + Month3Value + Month4Value + Month5Value + Month6Value + Month7Value + Month8Value + Month9Value + Month10Value + Month11Value + Month12Value)
I place this formula in the Details section of the subreport, as well as Group Footer 1 which is by 'Cost Center'
In the main report I have the Subreport in the Details section, and call the shared variable in this formula...
whileprintingrecords;
shared numbervar YTD_Actual_VolumeStat;
I place the formula in Group Footer 1, which is by Cost Center. Again, it works unless the main report has a Cost Center which does not exist in the subreport, in which case the preceding cost center value is used.
Any help is greatly appreciated, thank you
Andrew
numbervar Month1Value;
numbervar Month2Value;
numbervar Month3Value;
numbervar Month4Value;
numbervar Month5Value;
numbervar Month6Value;
numbervar Month7Value;
numbervar Month8Value;
numbervar Month9Value;
numbervar Month10Value;
numbervar Month11Value;
numbervar Month12Value;
if {T_STATISTIC_INPUT.DataSetID} startswith "ACTUAL"
then select {T_STATISTIC_INPUT.MonthNumber}
case 1 : Month1Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 2 : Month2Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 3 : Month3Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 4 : Month4Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 5 : Month5Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 6 : Month6Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 7 : Month7Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 8 : Month8Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 9 : Month9Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 10 : Month10Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 11 : Month11Value := tonumber ({T_STATISTIC_INPUT.MthValue})
case 12 : Month12Value := tonumber ({T_STATISTIC_INPUT.MthValue});
whileprintingrecords;
shared numbervar YTD_Actual_Paid_Hours := (Month1Value + Month2Value + Month3Value + Month4Value + Month5Value + Month6Value + Month7Value + Month8Value + Month9Value + Month10Value + Month11Value + Month12Value)
I place this formula in the Details section of the subreport, as well as Group Footer 1 which is by 'Cost Center'
In the main report I have the Subreport in the Details section, and call the shared variable in this formula...
whileprintingrecords;
shared numbervar YTD_Actual_VolumeStat;
I place the formula in Group Footer 1, which is by Cost Center. Again, it works unless the main report has a Cost Center which does not exist in the subreport, in which case the preceding cost center value is used.
Any help is greatly appreciated, thank you
Andrew