Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best method to recalc total of a column in grid
Message
From
02/09/2008 12:35:38
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01344151
Message ID:
01344199
Views:
18
Even simpler
Dodefault()
SELECT nvl(SUM(hrs),0) FROM linemarkingbody WITH (buffering=.t.) WHERE linemarkingbody.no=linemarkinghead.no AND required;
   into array laDummy 
REPLACE totalhrs WITH laDummy IN linemarkinghead
thisform.txtNHours.Refresh
>I've got a grid of entries, the two important columns are a tick box (required), and a time in hrs (hrs).
>
>Where is the best method to recalculate the total hours (TxtNHours), in the click event method or the interactive change event?
>
>My calculation code looks like this:
>
>
>DODEFAULT()
>SELECT SUM(hrs) as total FROM linemarkingbody WITH (buffering=.t.) WHERE linemarkingbody.no=linemarkinghead.no AND required INTO CURSOR tmptotal
>IF ISNULL(TMPTOTAL.TOTAL)
> REPLACE totalhrs WITH 0 IN linemarkinghead
>ELSE 
> REPLACE totalhrs WITH tmptotal.total IN linemarkinghead
>ENDIF 
>thisform.txtNHours.Refresh 
>
Previous
Reply
Map
View

Click here to load this message in the networking platform