All docs
V20.2
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

PivotDataFieldCollection.Insert(Int32, PivotField, String, PivotDataConsolidationFunction) Method

Inserts a field into the data area of a PivotTable report at the specified position.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll

Declaration

PivotDataField Insert(
    int index,
    PivotField field,
    string name,
    PivotDataConsolidationFunction summarizeValuesBy
)

Parameters

Name Type Description
index Int32

A zero-based index that specifies where to insert the data field.

field PivotField

A field that should be added to the data area.

name String

A name for the data field. This value is assigned to the PivotDataField.Name property.

summarizeValuesBy PivotDataConsolidationFunction

A summary function used to calculate values in the data field. This value is assigned to the PivotDataField.SummarizeValuesBy property.

Returns

Type Description
PivotDataField

The data field added to the pivot table.

Exceptions

Type Description
ArgumentOutOfRangeException

Occurs when the index parameter is out of range. It must be non-negative and less than the number of elements in the collection.

Remarks

Use this Insert method to add a new field to the data area at the specified position and specify a summary function used to calculate field values. The PivotDataField.ShowValuesWithCalculation method allows you to apply an additional calculation option to the data field and specify how summary values are displayed within the field.

Reorder Data Fields

Use the PivotDataField.MoveDown, PivotDataField.MoveUp, PivotDataField.MoveToBeginning, and PivotDataField.MoveToEnd methods to reorder fields in the data area. The PivotLayout.DataOnRows property allows you to change the orientation of multiple data fields in the report.

Remove Data Fields

Use the PivotDataFieldCollection.Remove or PivotDataFieldCollection.RemoveAt method to remove a data field from a pivot table. The PivotDataFieldCollection.Clear method removes all fields from the data area.

See Also