Running Total between Main Report and SubReport

Michael Katz
Michael Katz used Ask the Experts™
on
I believe I have to use Shared Variables but not sure how...

In Main Report.... in Detaila I have QtyOnHand...

I have a linked SubReport within Detailb...Detailb as 2 values.. 1 is Forecast the other is PO....

I need the QtyOnHand to Add to the Forecast and Subtract the PO... The Result needs then to look at the Next row of Forecast and PO and have a new Result..Continuing all the way however many rows are in the SubReport...at the bottom of the either the SubReport or Main Report I need to be the Net of all Results, Forecasts and PO..

Hopefully this makes sense

I have included a snapshot of what I am looking for in jpeg..
RunningTotal.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
It can't be done that way.

Assuming the subreports only have 1 row per detail row it is possible.

You need to insert a section below DetailsB.
Move everything except the subreports to detailsC.
Set detailsB to UNDERLAY FOLLOWING SECTIONS

Subreports are the last thing evaluated in the section so the values from the shared variables aren't updated until after the section is rendered.  By moving everything down a section except the subreports, the values will be available in DetailsC and you can calculate the column.

Underlaying will align the subreports so they show appropriately or you can have the subreports show nothing and display the shared values from the main report in details C.

mlmcc

Author

Commented:
I have created DetailsC....I moved everything to DetailsC that was in DetailsA...DetailsB still shows the sub report...Underlay has been turned on...

But the values haven't changed.. what am i missing?
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
What was in Details A?

The values in the subreports won't change.  If you want to use the values in the main report you have to do it in Details C.

Can you upload the report?

mlmcc
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Author

Commented:
Thanks again for putting up with my stupidity...here is the report
POvsForecast.rpt
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Your formulas aren't doing any accumulations.

Change the @QtyBal formula to

Shared numberVar QtyOH;
QtyOH := QtyOH + {Forecast.OriginalForecast} - {Forecast.OpenPo}

Open in new window


mlmcc

Author

Commented:
So where is the value for DetailsC??? I thought we needed to add a section.. Not complaining because this works.. just curious
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
I didn't realize the on hand column was being done in the subreport.  I thought that was in the main report in which case you needed the third details section.

mlmcc

Author

Commented:
sorry late awarding..but works well

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial