Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting SubTotal from Sub-report to Main report

Status
Not open for further replies.

Rena

Programmer
May 24, 2000
69
US
I have a main report that displays by material number:
Avg Cost
Amt Allocated
Total Allocated Cost

With a SUM of total allocated cost in the report footer.

In the report footer I have a sub-report that displays by material number:
Avg Cost
Amt On-hand
Total On-hand Cost

With a SUM of total on-hand cost in the report footer.

I need to get the SUM of total on-hand cost from the sub-report to the main report. I have tried using a shared variable with the following code:

@Sum_TotCst

WhilePrintingRecords ;

Shared currencyVar Sum_TotCst ;

If {ssinvent.uomcost} = 'M' Then
Sum_TotCst := Sum_TotCst + (({ssinvent.onhand} * {ssinvent.avgcost}) / 1000)
Else
If {ssinvent.uomcost} = 'CWT' Then
Sum_TotCst := Sum_TotCst + (({ssinvent.onhand} * {ssinvent.avgcost}) / 100)


When I put @Sum_TotCst in the RFb it only shows the value of the last total on-hand cost. Why isn't it summing? I don't declare this variable anywhere in the report so it isn't accidently getting cleared.

TIA,
Rena
 
The Report Footer only gets processed once per report. The variable only shows the last value because that's the only time it ever gets processed.

Move the formula and subreport to a multi-processing section - or if you have to have the subreport in Report Footer A, then do the summing in a multi-processing section of the subreport, and pass the total to the main report.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top