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

Sum a formula field 1

Status
Not open for further replies.

hlb6

Technical User
Aug 2, 2013
27
US
I need a grand total on the following formula (running totals will not work - it does not look at my conditions , so the running total is incorrect):
the name of the formula below is MeterUsage

IF COUNT ({work_order_test;1.Meter}, {work_order_test;1.EquipNumber})> 1
THEN
(IF (MAXIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}) -
MINIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}))> 0
THEN(MAXIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}) -
MINIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}))
ELSE 0.00)
ELSE

IF COUNT ({work_order_test;1.Meter}, {work_order_test;1.EquipNumber})= 1
THEN
(IF (MAXIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}) -
MINIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}))> 0
THEN(MAXIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}) -
MINIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}))
ELSE 0.00)
ELSE
MAXIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber}) -
MINIMUM({work_order_test;1.Meter},{work_order_test;1.EquipNumber})
 
The simplest way would be to use a vaiable to accrue the total. Amend your formula by adding the following code before and after your existing code:

Code:
WhilePrintingRecords;
Global NumberVar TOT;
Local  NumberVar REC :=

[COLOR=#EF2929][existing code here][/color]

;
TOT := TOT + REC;

REC

Then create the following formula and add it to the Report Footer to dislay the total:

Code:
WhilePrintingRecords;
Global NumberVar TOT;

Cheers
Pete
 
Works like a charm!! Thanks Pete - your an angel!!!!![bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top