PivotGridControl.GetColumnIndex(Object[], PivotGridField) Method
Returns the index of the specified column.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
NuGet Package: DevExpress.Win.PivotGrid
#Declaration
public int GetColumnIndex(
object[] values,
PivotGridField field
)
#Parameters
Name | Type | Description |
---|---|---|
values | Object[] | An array of column field values that identify the column. |
field | Pivot |
A Pivot |
#Returns
Type | Description |
---|---|
Int32 | An integer value that specifies the column index. -1 if the specified column has not been not found. |
#Remarks
Pivot Grid columns are indexed as shown below:
The field parameter allows you to specify the Data Field if the pivot grid displays data for several fields.
The following table demonstrates how to get indices for different columns.
C# | Visual Basic | Return Value |
---|---|---|
pivot |
pivot |
0 |
pivot |
pivot |
1 |
pivot |
pivot |
2 |
pivot |
pivot |
3 |
pivot |
pivot |
4 |
pivot |
pivot |
5 |
pivot |
pivot |
6 |
pivot |
pivot |
7 |
pivot |
pivot |
8 |
pivot |
pivot |
9 |
Note that the method requires the field values, which may be different from the displayed text. In the picture above, the DateTime field grouped by Month displays “August“ and has the value 8. The grand total columns has null values.
Tip
To display field values instead of automatically created and formatted strings, handle the Field