Contents | Index | < Browse | Browse >
DBSUM ALL|SELECTED|UNSELECTED %FieldName ResVar
This command is for DataBase listviews.
It will add the fields of ALL or the SELECTED or the UNSELECTED
records of the listview and place the result into ResVar.
ex:
; use a listview and go to the 1st record
lvuse mygui 1
lvgo first
; hide the listview for speed..
setgad mygui 1 HIDE
; unselect all records that may have been selected
lvmulti NONE
; go through all records, selecting all for which the field "%amount"
; is over 1000
while $$lv.line > ''
if $%amount > 1000
lvmulti ON
endif
lvgo next
endwhile
; sum all selected records
dbsum SELECTED %amount result
; print the result
say 'The total of all amounts over 1000 is : $resultn'
; set the listview back on
setgad mygui 1 SHOW