Skip to main content
A newer version of this page is available. .

PivotGridFieldSortBySummaryInfo.Field Property

Gets or sets the field whose summary values define the order in which the values of the current column field or row field are arranged.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v18.2.Core.dll

Declaration

[TypeConverter("DevExpress.XtraPivotGrid.TypeConverters.FieldReferenceConverter,DevExpress.XtraPivotGrid.v18.2, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[DefaultValue(null)]
public PivotGridFieldBase Field { get; set; }

Property Value

Type Default Description
PivotGridFieldBase *null*

A PivotGridFieldBase object which represents a field whose summary values determine the order of the current field’s values.

Remarks

This property determines the field against which a specific summary will be calculated and the resultant summary values will define the order in which the values of the current column field or row field will be arranged. The summary function type is determined by the PivotGridFieldBase.SummaryType property of the Field object.

If the Field property is set to null you can use the PivotGridFieldSortBySummaryInfo.FieldName property to specify the field whose summary values will be used to sort the column/row field values. The PivotGridFieldSortBySummaryInfo.FieldName property can be set to any field name contained in the control’s data source (even to a field name which has no bound PivotGridField object in the XtraPivotGrid control).

When using the PivotGridFieldSortBySummaryInfo.Field property the summary function type is determined by the field’s PivotGridFieldBase.SummaryType property. If using the PivotGridFieldSortBySummaryInfo.FieldName property you can define a different summary function type than that specified by the field’s PivotGridFieldBase.SummaryType property. Use the PivotGridFieldSortBySummaryInfo.SummaryType property for this purpose.

Example

This example demonstrates how to sort the values of a ‘Sales Person’ column field by summary values calculated against an ‘Order Amount’ data field. To do this, the PivotGridFieldSortBySummaryInfo.Field property of the ‘Sales Person’ field is set to reference the ‘Order Amount’ field. As a result, the values will be arranged in the order specified by the summary values.

The following images show the PivotGridControl before and after the field values are sorted by the summary values.

Before:

PivotGridField.SortBySummary_None

After:

PivotGridField.SortBySummary_Sum

pivotGridControl1.Fields["Sales Person"].SortBySummaryInfo.Field = 
  pivotGridControl1.Fields["Order Amount"];

The following code snippets (auto-collected from DevExpress Examples) contain references to the Field property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also