LIST NEWACC BYTES EVAL "BYTES+@2;@"
VOC......... Bytes.. BYTES+@2;@
ADDX 47 47
CHDIR 53 100
ENDPAGE 54 154
LNUM 64 218
On 7/2/2013 11:29 AM, Martin Phillips wrote:
Hi,
As far as I know, the only way to do this in U2 is to use either a common
variable or one of the @USERn variables in a subroutine to
accumulate the result. Handling multi-values is not hard (as below). Getting
this to work for breakpoint lines is a bit more
awkward.
For example, using UniVerse's demonstration sales database (INITIALIZE.DEMO), I
can create an I-type named ACCUM that reads
I
subr('ACCUMULATE', ITEM.TOTAL)
MD2
Cumulative
8R
M
BOUGHT
and a program catalogued as ACCUMULATE
function accumulate(item)
common /total/tot
if @ni = 1 then tot = 0
x = ''
n = dcount(item, @vm)
for i = 1 to n
tot += item<1,i>
x<1,i> = tot
next i
return (x)
end
I can then do
LIST ORDERS PROD.NO SELL QTY ITEM.TOTAL ACCUM
@ID.. Product No Sell..... Qty. Item Total Cumulative
10002 605 $40.00 1 $40.00 40.00
501 $5.00 1 $5.00 45.00
502 $5.00 1 $5.00 50.00
504 $5.00 1 $5.00 55.00
10006 112 $6.00 3 $18.00 73.00
10004 704 $115.00 1 $115.00 188.00
301 $10.00 9 $90.00 278.00
10005 502 $5.00 9 $45.00 323.00
10003 202 $5.00 10 $50.00 373.00
204 $5.00 10 $50.00 423.00
10001 112 $6.00 7 $42.00 465.00
418 $27.00 4 $108.00 573.00
704 $115.00 1 $115.00 688.00
10007 301 $10.00 3 $30.00 718.00
Maybe Rocket can be persuaded to implement the CUMULATIVE field modifier
keyword that we have in QM to make this trivial
Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wjhonson
Sent: 02 July 2013 01:36
To: [email protected]
Subject: [U2] Running total
Teach me again how to do a running total in a Access/Recall/English report.
I haven't done one in years, but I seem to recall that it's possible.
_______________________________________________
U2-Users mailing list
<mailto:[email protected]> [email protected]
<http://listserver.u2ug.org/mailman/listinfo/u2-users>
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users