Unfortunately, in UD the @ITEM.COUNT calculates values for LIST only. Therefore, if you do a SORT the 1st item listed may have an item count of 5675, the second listed might be 352, etc. Thus, it's very hard to figure out when you're starting the list in order to initialize the named common variables.

Bill

------------------------------------------------------------------------
Brian Leach said the following on 7/23/2009 9:38 AM:
Hi

Similar to Charles' but not exactly the same, this was for uv (clearer than
using @n) but should work for UDT as well:
ED DICT BOOK_TITLES RUNNING_TOTAL
This is a Type "I" Descriptor last compiled on 23/07/09 at 16:35.
20 lines long.

----: p
0001: I
0002: SUBR('RT','RUNNING_TOTAL',UNITS)
0003: MD0
0004: Run
0005: 10R
0006: S

ED BLP RT
19 lines long.

----: p
0001:       SUBROUTINE RT(ANS, WHICH, VALUE)
0002:       COMMON /RT/ RT.NAMES,RT.VALUES
0003:
0004:       IF @NI = 1 THEN
0005:          RT.NAMES = ''
0006:          RT.VALUES = ''
0007:       END
0008:       LOCATE WHICH IN RT.NAMES SETTING POS THEN
0009:          TOTAL = RT.VALUES<POS>
0010:       END ELSE
0011:          TOTAL = 0
0012:          RT.NAMES<-1> = WHICH
0013:          POS = DCOUNT(RT.NAMES,@FM)
0014:       END
0015:
0016:       TOTAL += VALUE
0017:       RT.VALUES<POS> = TOTAL
0018:       ANS = TOTAL
0019:       RETURN

LIST BOOK_TITLES RUNNING_TOTAL UNITS 04:37:46pm  23 Jul 2009  PAGE    1
Key.. Run....... Units

   10         22    22
   11         23     1
   12         30     7
   13         35     5
   14         41     6
   15         46     5
   16         47     1
   17         49     2
   18         52     3

Brian
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin
Sent: 23 July 2009 16:22
To: u2-users@listserver.u2ug.org
Subject: [U2] FW: Running total from UniData dict


I read this with great interest as I have an identical requirement. However, I use Unidata and this technique does not seem to work, in either ECLTYPE. Does anybody have a UDT solution?
Cheers,
Kebbon

From: bernard.lu...@pentanasolutions.com
To: u2-users@listserver.u2ug.org
Date: Tue, 30 Jun 2009 10:13:58 +1000
Subject: Re: [U2] Running total from UniVerse dict

Hi Kate,

Try this...  This will show the running total for every printed line

ED DICT FILENAME RUNNING.TOTAL
This is a Type "I" Descriptor last compiled on 30/06/09 at 09:07.
20 lines long.

----: P7
0001: I
0002: @1...@record<8>
0003: MD2
0004: RUNNING TOT
0005: 10R

Regards
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Kate Stanton
Sent: Tuesday, 30 June 2009 9:55 AM
To: U2 Users List
Subject: [U2] Running total from UniVerse dict

I am sure we used to be able to do this using I-type, but I cannot remember how.

Now we are using I-types again (not just ocreelatives), I want to be able to show each item outstanding for an account, with a running balance.

Can anyone help?

I have been to the doc, and read about CALC and TOTAL, but they seem to apply to totalling lines (and I can't make that work either - I am feeling very inadequate).

TIA, Kate

Kate Stanton
Walstan Systems Ltd
4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand
Ph: +64 9 360 5310  Fax: +64 9 376 0750  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

Reply via email to