Charlie,

That's what

IF ItemCount = 1 THEN runningtotal = 0

does.

Dan

On Sat, Nov 12, 2011 at 10:06 AM, Charlie Noah <[email protected]> wrote:

>  Don't forget to clear the common variable before each report, otherwise
> you'll end up with strange results.
>
> Charlie Noah
>
> Tiny Bear's Wild Bird Store
> "Everything For The Backyard Bird Enthusiast, Except For The Birds"
> Info, Forum:  http://www.TinyBearMarketing.com
> Store:            http://Stores.TinyBearMarketing.com
>
> On 11-12-2011 7:21 AM, comp.lang.smalltalk wrote:
>
> There is nothing intrinsic in jBASE (or any other multi-value
> implementation that I know of) that can do running totals.
>
> A dictionary subroutine would be able to accomplish this. Here is a
> simple example:
>
> Create a file called TEST with 3 records:
>
>     A
> 001 1
>
>     B
> 001 2
>
>     C
> 001 3
>
> Create this subroutine:
>
> 0001     SUBROUTINE runtot
> 0002     COMMON /runtot/ runningtotal
> 0003     INCLUDE qbasiccommonpick
> 0004     EQU ItemCount TO access(4)
> 0005     IF ItemCount = 1 THEN runningtotal = 0
> 0006     runningtotal += access(3)<1>
> 0007     newpick(12) = runningtotal
> 0008     RETURN
>
> Create this dictionary:
>
>    RT
> 001 A
> 002 1
> 003
> 004
> 005
> 006
> 007
> 008 CALL runtot
> 009 R
> 010 6
>
> jsh ~ -->LIST TEST *A1 RT
>
> TEST.......... *A1........... RT....
>
> A              1                   1
> B              2                   3
> C              3                   6
>
> You would have to perform the BASIC equivalent of
>
> A;S(N(MATERIAL-COST) * N(MULT)R)
>
> and plug that into the code in place of 'access(3)<1>'.
>
> I know stuff ;-)
>
> Dan
>
>
> On Nov 10, 2:32 pm, wsw <[email protected]> <[email protected]> wrote:
>
>  Is there a way to obtain a running total for a single value attribute
> using a dictionary entry? Using A;S(N(MATERIAL-COST) * N(MULT)R),
> where MULT = 1, I can obtain the total value of a multivalue
> attribute.
>
> Thanks,
>
> WW
>
>   --
> Please read the posting guidelines at:
> http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> IMPORTANT: Type T24: at the start of the subject line for questions
> specific to Globus/T24
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>

-- 
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Reply via email to