I thought this worked, but it does not

Jeff Harrison Jeff.Harrison at Epixweb.com
Mon Jun 14 10:55:42 PDT 2004


Ken Brody wrote:
> 
> Jeff Harrison wrote:
> > 
> > Hmm, I just got bitten by the total function again.  I 
> thought that you
> > could use this function to total up different things based 
> on a condition,
> > but it did not work the way I expected.  Here is some 
> sample processing and
> > data that demonstrates this.
> > 
> > Data:
> > 
> > Field1(30,*)    Field6(3,.0)    Field7(3,.0)
> > "T"                     "1"                     "2"
> > "X"                     "1"                     "2"
> > 
> > Processing:
> > :1 eq "T":aa=tot(6):
> > :1 ne "T":aa=tot(7):
> > ::end:
> > @wgt:::
> > ::msgbox "aa="<aa:
> > ::end:
> > ::aa(3,.0):
> > 
> > The msgbox function shows aa as "2", although I would 
> expect it to be "3"
> > 
> > Is this a feature?  Aren't you supposed to be able to do this?
> 
> You asked for the total of field 7 in those records where field 1 was
> not equal to "T" (since the last record was not equal to "T"), not for
> record_1_field_6 plus record_2_field_7.
> 
> Either use "aa=aa+6" and "aa=aa+7", or use "aa=tot(6)" and "ab=tot(7)"
> and then "aa+ab" when you want their combined sum.
> 
>

Ok, so you are saying that if I use the tot function multiple times with the
assignment going to the same field, then only the last assignment is
effective?

Jeff Harrison
jeff.harrison at epixweb.com

Author of JHExport and JHImport - The fastest and easiest ways to generate
code for filepro exports and imports.  Demos available upon request.
 


More information about the Filepro-list mailing list