Skip to main content
Row

PivotDataFieldCollection.Insert(Int32, PivotField, String) Method

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

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

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

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.

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

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.

Change Summary Function

Use the PivotDataField.SummarizeValuesBy property to change the default summary function used to calculate values in a data field. 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.

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