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.v24.1.Core.dll
NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
Declaration
[TypeConverter("DevExpress.XtraPivotGrid.TypeConverters.FieldReferenceConverter,DevExpress.XtraPivotGrid.v24.1, Version=24.1.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
public PivotGridFieldBase Field { get; set; }
Property Value
Type | Description |
---|---|
PivotGridFieldBase | 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.
Note
You cannot use the CalculationBindingBase descendants to apply sorting by summary when Pivot Grid operates with Optimized calculation engine.
Refer to the following example for information on how to use a hidden field to sort the visible field values when Pivot Grid operates in Optimized mode:
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:
After:
pivotGridControl1.Fields["Sales Person"].SortBySummaryInfo.Field =
pivotGridControl1.Fields["Order Amount"];
Related GitHub Examples
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.