PivotDataField.GetPivotData(PivotItemReference[]) Method
Retrieves summary data for the specified items of the pivot table.
Namespace: DevExpress.Spreadsheet
Assembly:
DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package:
DevExpress.Spreadsheet.Core
Declaration
CellValue GetPivotData(
params PivotItemReference[] references
)
Function GetPivotData(
ParamArray references As PivotItemReference()
) As CellValue
Parameters
Returns
Use the GetPivotData property to obtain summary data stored in a PivotTable report. The PivotItemReference objects allow you to specify the field and item pairs for which the data should be returned.
If the requested data cannot be retrieved, the GetPivotData method returns the #REF! error.
The following examples demonstrate how the GetPivotData property works. All examples refer to the pivot table shown in the image below.
Example
| Result
|
---|
pivotTable.DataFields[0].GetPivotData();
pivotTable.DataFields(0).GetPivotData()
| Returns the numeric value 148232, which is the grand total of all values in the pivot table.
|
// Create a reference to the "Q1" item of the "Quarter" field.
PivotItemReference item = new PivotItemReference(0, 0);
// Retrieve the summary data for this item.
pivotTable.DataFields[0].GetPivotData(item);
' Create a reference to the "Q1" item of the "Quarter" field.
Dim item As New PivotItemReference(0, 0)
' Retrieve the summary data for this item.
pivotTable.DataFields(0).GetPivotData(item)
| Returns the numeric value 67249, which is the grand total for the first quarter.
|
// Create a reference to the "Q1" item of the "Quarter" field.
PivotItemReference item1 = new PivotItemReference(0, 0);
// Create a reference to the "Dairy Products" item of the "Category" field.
PivotItemReference item2 = new PivotItemReference(4, 0);
// Retrieve the summary data for the specified items.
pivotTable.DataFields[0].GetPivotData(item1, item2);
' Create a reference to the "Q1" item of the "Quarter" field.
Dim item1 As New PivotItemReference(0, 0)
' Create a reference to the "Dairy Products" item of the "Category" field.
Dim item2 As New PivotItemReference(4, 0)
' Retrieve the summary data for the specified items.
pivotTable.DataFields(0).GetPivotData(item1, item2)
| Returns the numeric value 46070, which is the total of the dairy product sales for the first quarter.
|
// Create a reference to the "Q1" item of the "Quarter" field.
PivotItemReference item1 = new PivotItemReference(0, 0);
// Create a reference to the "Big Foods" item of the "Customer" field.
PivotItemReference item2 = new PivotItemReference(2, 1);
// Create a reference to the "Dairy Products" item of the "Category" field.
PivotItemReference item3 = new PivotItemReference(4, 0);
// Retrieve the summary data for the specified items.
CellValue value = pivotTable.DataFields[0].GetPivotData(item1, item2, item3);
' Create a reference to the "Q1" item of the "Quarter" field.
Dim item1 As New PivotItemReference(0, 0)
' Create a reference to the "Big Foods" item of the "Customer" field.
Dim item2 As New PivotItemReference(2, 1)
' Create a reference to the "Dairy Products" item of the "Category" field.
Dim item3 As New PivotItemReference(4, 0)
' Retrieve the summary data for the specified items.
Dim value As CellValue = pivotTable.DataFields(0).GetPivotData(item1, item2, item3)
| Returns the numeric value 8652, which is the value of the dairy product sales for the “Big Foods” customer in the first quarter.
|
// Create a reference to the "Big Foods" item of the "Customer" field.
PivotItemReference item = new PivotItemReference(2, 1);
// Retrieve the summary data for this item.
pivotTable.DataFields[0].GetPivotData(item);
' Create a reference to the "Big Foods" item of the "Customer" field.
Dim item As New PivotItemReference(2, 1)
' Retrieve the summary data for this item.
pivotTable.DataFields(0).GetPivotData(item)
| Returns the #REF! error value because there is no total value of sales for the “Big Foods” customer.
|
// Create a reference to the "Q3" item of the "Quarter" field.
PivotItemReference item = new PivotItemReference(0, 2);
// Retrieve the summary data for this item.
pivotTable.DataFields[0].GetPivotData(item);
' Create a reference to the "Q3" item of the "Quarter" field.
Dim item As New PivotItemReference(0, 2)
' Retrieve the summary data for this item.
pivotTable.DataFields(0).GetPivotData(item)
| Returns the #REF! error value because the sales data for the third quarter is not shown in the pivot table.
|
See Also