Skip to main content

PivotGridControl.RetrieveFields() Method

Creates PivotGridField objects for all columns in the bound data source.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.2.dll

Declaration

public void RetrieveFields()

Remarks

This method clears the field collection and adds new PivotGridField objects to the collection for all columns in the control’s bound data source.

The RetrieveFields method generates DataSourceColumnBinding objects for each Pivot Grid field in OLAP, Server, and Optimized modes. The Pivot Grid fields obtain their values from columns in the data source. The DataSourceColumnBindingBase.ColumnName property is set to the name of the data source column. The created fields are made visible and displayed within the Filter Header Area.

Use the PivotGridControl.Fields property to add or remove fields. For instance, you can add a calculated field to a collection that contains arbitrary data in the Pivot Grid control. Refer to the following topic for more information about calculated fields: Bind Pivot Grid Fields to Calculated Expressions.

Use the PivotGridControl.RetrieveFieldsAsync method to create fields asynchronously.

Specify a value of the PivotGridFieldBase.Name property for each field when you create Pivot Grid fields. The value can be used to determine fields in a stored layout. For example, the following code snippet sets field names for all fields in the Pivot Grid:

pivotGridControl1.RetrieveFields();
foreach(PivotGridField field in pivotGridControl1.Fields)
field.Name = "field" + (field.DataBinding as DataSourceColumnBinding).ColumnName;

Refer to the following topic for more information about Pivot Grid Fields: Pivot Grid Fields.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RetrieveFields() method.

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