Compute summary values

Description

You can specify that client-side summary values should be computed for any column in a list.

To turn on client-side summary values for a field in the List, check the property shown below in the List builder:

For Lists based on SQL data, you can also specify server-side summary values. Server-side summary values are only different than client-side summary values if the List is paginated. Server-side summary values compute the summary based on the List query, whereas client-side summary values are based on the data that is currently loaded into the List. In the case of the paginated List, there can be many more records in the List query than are displayed in the List.

When you compute summary data for a List column, you will typically want to display the data on the UX component. The List's afterClientSideSummaryCompute event is useful for this. The afterClientSideSummaryCompute fires after the client-side summary values have been updated. In this event handler you can reference the summary data that was computed. Here are some examples of how your Javascript code can reference summary values:

csSummary['QTY'].total
csSummary['PRICE'].avg
csSummary['PRICE'].max

The 'csSummary' object contains all of the summary data. The field name must be in uppercase and the summary type (total, avg, count, min, or max) must be in lower case. You can also use a method of the UX object to read a List summary value using the following method:

{dialog.object}.getListClientSideSummaryValue(listName, fieldName, summaryType)

For example:

var tot = {dialog.object}.getListClientSideSummaryValue('list1','QTY','total');