TOT(0 seems broke

Bruce Easton bruce at stn.com
Wed Mar 7 09:09:16 PST 2007


Kenneth Brody wrote Wednesday, March 07, 2007 10:40 AM:
> > Also, here's something you can do with TOT() that will delight and
> > confuse everyone here.   :-)
> >
> >       If:  foobar eq "Y"
> >     Then:  xx = tot(foo)
> >       If:  foobar ne "Y"
> >     Then:  xx = tot(bar)
> >
> > What would you expect "xx" to hold?  I'll tell you right away that
> > it is _not_ the same as
> >
> >       If:  foobar eq "Y"
> >     Then:  xx = xx + foo
> >       If:  foobar ne "Y"
> >     Then:  xx = xx + bar
> >
> > --
> >
> > Is xx a global dummy?
>
> It doesn't matter.  (After all, xx is explicitly being set a value
> in the code, so its previous contents are irrelevent.)
>
> However, for the sake of argument, say it is. Say that foo and bar
> are both (6,.0) and xx is (8,.0,g).
>

I would expect xx in the first example to hold only the total of foo at that
point, if the last occurrence of foobar was "Y", otherwise it would only be
the total of bar at that point.

In the second, I would expect xx to be the total of all of occurrences that
foo and bar held at that point.

Bruce

Bruce Easton
STN, Inc.



More information about the Filepro-list mailing list