Kate,
 
This gives strange results if F1 is multi-valued so attribute 2
of the dict item needs to be: @1+SUM(F1)

Thanks,
Don Robinson


________________________________
From: Kate Stanton <k...@walstan.com>
To: U2 Users List <u2-users@listserver.u2ug.org> 
Sent: Tuesday, July 2, 2013 6:32 PM
Subject: Re: [U2] Running total


Are you looking for @1?  This gives a column containing running total (I
learned it from this list)

DICT AP F1        invoice value (A type or I type)
            T1        running total I type: F2:  @1 + F1

So, listing 3 items gives:

LIST AP TOTAL F1 KATE 10:26:30am  03 Jul 2013  PAGE    1
APID......... INV......... T1.........
              AMT.........

101*850563      52,578.24    52,578.24
101*850568          -86.24    52,492.00
101*850569          86.24    52,578.24

***              52,578.24

3 records listed.



On 2 July 2013 20:29, Martin Phillips <martinphill...@ladybridge.com> 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: u2-users-boun...@listserver.u2ug.org [mailto:
> u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
> Sent: 02 July 2013 01:36
> To: u2-users@listserver.u2ug.org
> 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:U2-Users@listserver.u2ug.org> U2-Users@listserver.u2ug.org
>
>  <http://listserver.u2ug.org/mailman/listinfo/u2-users>
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>



-- 
Kate Stanton
Walstan Systems Ltd
4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand
Phone: + 64 9 360 5310  Mobile: + 64 21 400 486
Email: k...@walstan.com
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to