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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decremental subtract from a total On Hand Qty 1

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
A Part Number has total on-hand qty that needs to subtract each Sales Order demand qty for that part number. So if part 123 has 1000 on-hand and there is a demand 1,then 2 and 5. The remaining on-hand needs to show the resultant Qty On Hand.
Qty On Hand 1000 minus Demand qty 1 = 999 (resultant qty).
Qty On Hand 999 minus Demand qty 2 = 997 (resultant qty).
Qty On Hand 997 minus Demand qty 5 = 992 (resultant qty).

The formulas that I have tried are:
GroupHeader Section:
@Initialize
whileprintingrecords;
NumberVar onhand := 0;

GroupHeader Section:
whilereadingrecords;
numbervar onhand := {Command.TotalQTY}

Details:
whilereadingrecords;
numbervar onhand := onhand - @demandqty






 
Eliminate your initialization formula and change whilereadingrecords to whileprintingrecords in both remaining formulas. Your group header formula setting the initial amount acts as your initialization formula.

-LB
 
Thank you for the guidance. I was so close. What is the difference between functions of whilereadingrecords vs whileprintingrecords??

Worked like a charm!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top