In many cases you will need to create groupings and totals. Suppose you want to have a sub total and a grand-total of salaries for each employee.

To setup we need to reopen the fields property of the grid, and select the salary field.        


The group-by field is set to emp_no, and then open the function property editor



Here we define the grouped sum for the field. 


This output is correct, but can be improved. For instance by adding the title for the sum. You can do that by adding a custom field:



Clicking on 'group desc' create a special column for this label.



So far we have concentrated us to the query on the table. But there are some settings of the grid as well to improve the output even more.


By defining the group-by on the grid level you can apply additional behavior like collapsing. There is a draw-back however, as the grid contains more rows now, you cannot use this grid for crud operation. Selecting a row does not sync with the real table behind it. Use this feature only for reporting grids.





You can apply grand totals and other functions similarly.