Previous Topic: Post-Processed DocumentsNext Topic: Derived Searches


Displaying Aggregate Totals

Including aggregate totals in the search results returned by the stored procedure is problematic because only a single resultset is returned and the totals will not be distinguishable from regular data. The row of totals will be subject to sorting and filtering, confusing the results display. To overcome this limitation it's possible to request aggregate totals for a search by specifying show_totals="true" on the results element of the search definition. By default this will create a sum for every numeric, quantity or real column. The following functions are supported:

Avg

Calculate an average for the column.

Count

Count all the non-blank rows in the column.

Max

Show the maximum value for the column.

Min

Show the minimum value for the column.

StDev

Calculate the standard deviation for the column.

Sum

Add up all the values in the column.

Var

Calculate the variance for the column

The Count function can also be used for non-numeric columns.

To specify an alternative function, use the total_function attribute on the column element. For example, total_function="avg".

Note: If no total is required for a numeric column specify total_function="none".

The totals for the whole resultset will be displayed in the last line of results. If the results are paged; that is, the page does not contain all results, an additional line of totals will be included as the penultimate line showing the aggregate totals for the page. The style of the totals rows can be customized using the #trResultsPageTotal style for the page totals and the #trResultsTotal style for the overall totals.

Note: The aggregate functions for the grand totals will also be included in an Excel download of the results.