Totalizers

WorkWithPlus provides the possibility to add totalizers for the columns that are numeric in any regular grid created using WorkWithPlus. This is set on the property Totalizer for each attribute or variable within the grid, and the total will be displayed at the bottom of the respective column.

TotalizersImg01

It's very easy to configurate, just change the property Totalizer of a numeric attribute to Sum or to Average, as it is displayed in the image above.

At runtime, this totalizer will be always alineated to the column itself.

TotalizersImg02

What WorkWithPlus adds as a code to achieve this is two subroutines 'InitializeTotalizers' and 'CalculateTotalizers' which are used in Refresh event:

TotalizersImg03

TotalizersImg04

You can change the description that is next to the totalizer value in WorkWithPlus Settings -> Labels -> Properties Totalizer Sum and Totalizer Average.

When you add totalizer to a variable in a Selection object, it has to have the property 'Load code' with the value of how its going to be loaded, so that WorkWithPlus can calculate the total of that variable.

TotalizersImg05

When you add totalizer in an independent Web Panel and the grid is based on an SDT Collection, WorkWithPlus will also do the calculation all automatically. 

But when the grid is not based on an SDT (only contains variables or attributes) WorkWithPlus will only define the variables and add them on the Web Form, but you will have to add the code to calculate the totals because depends on the code added in 'Grid.load' event. The variables that WorkWithPlus defines for each attribute/varaible with totalizers are:

  • &Tot<VariableName> as numeric. This variable is the one that will be used for the calculation
  • &TotValue<VariableName> as varchar and is the one that is displayed on the form.