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

A running total cannot refer to a print time formula

Status
Not open for further replies.

bslaast

MIS
Oct 22, 2009
46
US
I am receiving the arror "A running total acnnot refer to print time formula"

I want to get how many, the and how many days parts have been in inventory. I also want know break down the quantities and costs by <1 year in inventory, 2 years in inventory and 3+ years in inventory.

I have am grouping on {inventory.part_no}

In the details section:
{@quantity} that calculates the quantity in inventory
if {INVENTORY_TRANSACTION_HIST\.DIRECTION} = "-" then {INVENTORY_TRANSACTION_HIST\.QUANTITY}*-1
else {INVENTORY_TRANSACTION_HIST\.QUANTITY}

{@extendedcost} that calculates the cost in inventory
if {INVENTORY_TRANSACTION_HIST\.DIRECTION} = "-"
then {INVENTORY_TRANSACTION_HIST\.COST}*{INVENTORY_TRANSACTION_HIST\.QUANTITY}*-1
else {INVENTORY_TRANSACTION_HIST\.COST}*{INVENTORY_TRANSACTION_HIST\.QUANTITY}

{#maxdate} finds the most recent date the part was put into inventory
field to summarize: {INVENTORY_TRANSACTION_HIST\.DATE_APPLIED}
type of summary: maximum
Evaluate by formula: if {INVENTORY_TRANSACTION_HIST\.DIRECTION} = "+" then true
Reset on change of group.


In the group footer:
group sum of {@quantity}
group sum of {@extedndedcost}
{@maxdate} calculates how many days by substracting the day put into inventory from the current date
CurrentDate-{#maxDate}

In the report footer:
report sum of {@quantity}
report sum of {@extedndedcost}

I am having troubles totaling the cost/quanity based on {@maxdate}.


 
You need to use a variable

Place this in Group footer
@TotMaxD
Whileprintingrecords;

Global numbervar TotMaxD;

TotMaxD:= TotMaxD + {@maxdate}

Display in report Footer
@Display TotMaxD
Whileprintingrecords;

Global numbervar TotMaxD;

Ian
 
That just totals the days. I need to total the costs based on the number of days. So if the number of days <365 I want a running total of those costs, >= 365 and < 730 a running total of those costs, >=730 and <1095 a running total of those costs.
 
I figured it out. I changed the Group Footer variable to:

Whileprintingrecords;
Global numbervar TotLess1Yr;
if {@maxdate} < 365 then
TotLess1Yr:= TotLess1Yr + {@extendedcost}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top