---
schema_version: "1"
id: ab08d17ca5bba08a47ce93b86e900ae0ee09d1d778ecc7dde2311bf04de53834
title: GroupingInfo Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_reports_groupinginfo.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_reports_groupinginfo.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 02b3bfab1e364103624cc1649038c14214290393a1a3b7bfaa691901f5530b97
description: Contains methods for describing fields that are used for grouping.Returns the unique API name of the field or bucket field that is used for row or column grouping.Returns the order that is used to sort data in a row or column grouping (ASCENDING or DESCENDING).Returns the date interval that is used for row or column grouping.Returns the summary field that is used to sort data within a grouping in a summary report. The value is null when data within a grouping is not sorted by a summary field.
---
# GroupingInfo Class

Contains methods for describing fields that are used for grouping.

## Namespace

[Reports](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Reports.htm "The Reports namespace provides classes for accessing the same data as is available in the Salesforce Reports and Dashboards REST API.")

## GroupingInfo Methods

The following are methods for GroupingInfo. All are instance methods.

- **[getName()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_reports_groupinginfo.htm#apex_Reports_GroupingInfo_getName)**  
    Returns the unique API name of the field or bucket field that is used for row or column grouping.
- **[getSortOrder()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_reports_groupinginfo.htm#apex_Reports_GroupingInfo_getSortOrder)**  
    Returns the order that is used to sort data in a row or column grouping (ASCENDING or DESCENDING).
- **[getDateGranularity()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_reports_groupinginfo.htm#apex_Reports_GroupingInfo_getDateGranularity)**  
    Returns the date interval that is used for row or column grouping.
- **[getSortAggregate()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_reports_groupinginfo.htm#apex_Reports_GroupingInfo_getSortAggregate)**  
    Returns the summary field that is used to sort data within a grouping in a summary report. The value is null when data within a grouping is not sorted by a summary field.

### getName()

Returns the unique API name of the field or bucket field that is used for row or column grouping.

#### Syntax

public String getName()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### getSortOrder()

Returns the order that is used to sort data in a row or column grouping (ASCENDING or DESCENDING).

#### Syntax

public Reports.ColumnSortOrder getSortOrder()

#### Return Value

Type: [Reports.ColumnSortOrder](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_reports_columnsortorder.htm "The Reports.ColumnSortOrder enum describes the order that the grouping column uses to sort data.")

### getDateGranularity()

Returns the date interval that is used for row or column grouping.

#### Syntax

public Reports.DateGranularity getDateGranularity()

#### Return Value

Type: [Reports.DateGranularity](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_reports_dategranularity.htm "The Reports.DateGranularity enum describes the date interval that is used for grouping.")

### getSortAggregate()

Returns the summary field that is used to sort data within a grouping in a summary report. The value is null when data within a grouping is not sorted by a summary field.

#### Syntax

public String getSortAggregate()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")