Gordon Hughes
asked on
How to total a sub report
I have a report with a sub report for Labour Hours
With a @Sum of @Labour_Hrs
I have created a shared formula in the sub report
@DECVAL
WhilePrintingRecords;
Shared numberVar BudgetValue ;
BudgetValue
in the main report have also created @DECVAL
WhilePrintingRecords;
Shared NumberVar Hours := 0;
Have created a formla in the main report @Labour Hours
WhilePrintingRecords;
Shared NumberVar Hours := 0;
The main report has a group called @Equiplocation
I would like to sum the @Labour Hours on the main report in both the @Equiplocation group and footer
Gordon
With a @Sum of @Labour_Hrs
I have created a shared formula in the sub report
@DECVAL
WhilePrintingRecords;
Shared numberVar BudgetValue ;
BudgetValue
in the main report have also created @DECVAL
WhilePrintingRecords;
Shared NumberVar Hours := 0;
Have created a formla in the main report @Labour Hours
WhilePrintingRecords;
Shared NumberVar Hours := 0;
The main report has a group called @Equiplocation
I would like to sum the @Labour Hours on the main report in both the @Equiplocation group and footer
Gordon
ASKER
Hi James
Good to hear from you
The sub report DECVAL is
shared numbervar Hours;
if isnull (Sum ({@Labour_Hrs})) then Hours:=0.00 else
Hours:= Sum ({@Labour_Hrs})
not the one I intially sent
Gordon
Good to hear from you
The sub report DECVAL is
shared numbervar Hours;
if isnull (Sum ({@Labour_Hrs})) then Hours:=0.00 else
Hours:= Sum ({@Labour_Hrs})
not the one I intially sent
Gordon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
As usual a working solution
Basically, if you have a value in a subreport that you want to use in the main report, you put that value in a shared variable in the subreport, and then use that shared variable in the main report, in a formula that's located in a section that comes after the section that the subreport is in. If you want to add a total from the subreport, you can have a formula add each amount to the variable. For example, in a subreport detail section you might have a formula with a line like Hours := Hours + {some field}. Or, in the subreport report header or footer, you might have a formula with a line like Hours := Sum ({some field}), to put the total from the subreport in the variable.
If you're trying to get a total for a group in the main report, you would put a formula in the group header in the main report that reset the variable to 0 for each new group.
Without knowing more about your report and exactly what you're trying to do, it's hard to be specific.
James