DroidDB Tip of the Month
DroidDB® Tip for January 2016
Calculating the Sum of a Column
You may want to calculate the sum of the values in a column. You can do this using a grid control.
To do this, do the following:
- On the desktop, open the form designer and open up the form.
- Select CONTROL | GRID to create a grid control.
- Turn on "Show all records" and press OK.
- Click "Add After".
- Select the name of the column you want to sum up in the "Name" dropdown.
- Select the variable to hold the result in the "Sum into" dropdown.
- Click OK to the Grid Column dialog.
- Click OK to the Grid Properties dialog.
- Resize the grid control so that it is very small. Alternatively, in the form's startup macro, hide the control.
When the form runs, the sum of the column will be calculated and be placed in the variable selected.