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.v20.1.Core.dll

Declaration

[DefaultValue(null)]
public PivotGridFieldBase Field { get; set; }
<DefaultValue(Nothing)>
Public Property Field As PivotGridFieldBase

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.

Examples

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"];
See Also