As long as we're on the subject, how about a running average?
[running average] = [running total] / [number of items so far]
@NI is the item counter as the LIST command proceeds.
Using any of the methods discussed so far to get the running total,
divide by @NI:
DICT ORDER.DETAIL RUNAVG
01: I
02: (QTY + @1); @ / @NI
Or Brian's:
01: I
02: SUBR('RT','RUNNING_TOTAL',UNITS); @ / @NI
SORT ORDER.DETAIL BY ORDER.DATE _
ID-SUPP NI @ID ORDER.DATE TOTAL QTY RUNTOT RUNAVG
NI... ORDER..... Order... Qty. RunTot. RUNAVG....
DETAIL.... Date.... Example
1. 10004_1 12/28/99 704 704 704.00
2. 10007_1 01/12/00 301 1005 502.50
3. 10005_1 01/15/00 502 1507 502.33
4. 10001_2 01/23/00 418 1925 481.25
5. 10002_1 01/24/00 605 2530 506.00
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users