*Custom form method Sigma
select sum(eExpression1), ;
sum(eExpression2),.. ;
from cTablename ;
into array this.aSigma
* Form.init
this.Sigma && Do summing on entry
* Any field's lostfocus that would effect sum
thisform.SigmaUpdate(nArrayPos,this)
* Custom form method SigmaUpdate
* nArrayPos - Position of array element effected
lParameters nArrayPos, oNumField
cFieldName = substr(oNumfield.controlsource,;
at(".",oNumfield.controlsource)+1)
cRecSource = substr(oNumfield.controlsource,1, ;
at(".",oNumfield.controlsource)-1)
nOldVal = iif(isnull(oldval(cFieldName,cRecSource)),0, ;
oldval(cFieldName,cRecSource))
nNewVal = iif(isnull(oNumfield.value),0, ;
oNumfield.value)
this.aSigma[nArrayPos] = this.aSigma[nArrayPos] ;
+ (nNewVal - nOldVal)
this.refresh
CetinÇetin Basöz
The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses
LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad