Package com.isomorphic.datasource

# Enum Class SummaryFunctionType

java.lang.Object
java.lang.Enum<SummaryFunctionType>
com.isomorphic.datasource.SummaryFunctionType

All Implemented Interfaces:
  `Serializable`, `Comparable<SummaryFunctionType>`, `Constable`

public enum SummaryFunctionType extends Enum<SummaryFunctionType>
Function to produce a summary value based on an array of records and a field definition. An example usage is the ListGrid.setShowGridSummary(), where a row is shown at the bottom of the listGrid containing summary information about each column.

SummaryFunctions may be specified in one of 2 ways:

- as an explicit function that takes 3 parameters:
  - `records` an array of records
  - `field` the field definition for which the summary is required
- As an predefined `SummaryFunctionType` type.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ARRAY`
  Returns a list of the values of the summary field in all matching records.
  `AVG`
  Iterates through the set of records, picking up all numeric values for the specified field and determining the mean value.
  `CONCAT`
  Returns a string concatenation of the values of the summary field in all matching records.
  `CONCAT_DISTINCT`
  Like `CONCAT`, but removes duplicate values before concatenation.
  `COUNT`
  Returns a numeric count of the total number of records passed in.
  `COUNT_DISTINCT`
  Returns the number of distinct non-null values of the summary field across matching records.
  `FIRST`
  Currently behaves the same way as `MIN`.
  `MAX`
  Iterates through the set of records, picking up all values for the specified field and finding the maximum value.
  `MIN`
  Iterates through the set of records, picking up all values for the specified field and finding the minimum value.
  `SUM`
  Iterates through the set of records, picking up and summing all numeric values for the specified field.

- ## Enum Constant Details

  - ### FIRST

    public static final SummaryFunctionType FIRST
    Currently behaves the same way as `MIN`.

  - ### SUM

    public static final SummaryFunctionType SUM
    Iterates through the set of records, picking up and summing all numeric values for the specified field. Returns null to indicate invalid summary value if any non numeric field values are encountered.

  - ### AVG

    public static final SummaryFunctionType AVG
    Iterates through the set of records, picking up all numeric values for the specified field and determining the mean value. Returns null to indicate invalid summary value if any non numeric field values are encountered.

  - ### MAX

    public static final SummaryFunctionType MAX
    Iterates through the set of records, picking up all values for the specified field and finding the maximum value. Handles numeric fields and date type fields only. Returns null to indicate invalid summary value if any non numeric/date field values are encountered.

  - ### MIN

    public static final SummaryFunctionType MIN
    Iterates through the set of records, picking up all values for the specified field and finding the minimum value. Handles numeric fields and date type fields only. Returns null to indicate invalid summary value if any non numeric field values are encountered.

  - ### COUNT

    public static final SummaryFunctionType COUNT
    Returns a numeric count of the total number of records passed in.

  - ### COUNT_DISTINCT

    public static final SummaryFunctionType COUNT_DISTINCT
    Returns the number of distinct non-null values of the summary field across matching records. Emits `COUNT(DISTINCT column)` — standard SQL-92, supported by all SQL drivers. Result type is always integer regardless of the source column type. Single-field only; multi-column DISTINCT is not supported.

    Also supported client-side for clientOnly and cached DataSources.

  - ### CONCAT

    public static final SummaryFunctionType CONCAT
    Returns a string concatenation of the values of the summary field in all matching records.

    Natively supported on Oracle (LISTAGG), PostgreSQL (string_agg), and MySQL (GROUP_CONCAT). On other databases, implemented with a separate concatFetch query. Also supported client-side for clientOnly and cached DataSources.

  - ### CONCAT_DISTINCT

    public static final SummaryFunctionType CONCAT_DISTINCT
    Like `CONCAT`, but removes duplicate values before concatenation.

    Natively supported on Oracle 19c+ (LISTAGG DISTINCT), PostgreSQL 9.0+ (string_agg DISTINCT), and MySQL (GROUP_CONCAT DISTINCT). On other databases and for the Java concatFetch fallback, deduplication is applied programmatically after fetching values. Also supported client-side for clientOnly and cached DataSources.

  - ### ARRAY

    public static final SummaryFunctionType ARRAY
    Returns a list of the values of the summary field in all matching records.

    Implemented with a separate database fetch with SQLDataSource. Also supported as a post-process function on generic DataSource implementations that do not inherently support aggregation. Not supported by the Hibernate and JPA DataSources