Skip to main content

PivotGridControl.GetFieldValueOlapMember(PivotGridField, Int32) Method

Returns an OLAP member for the specified field value.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v23.2.dll

NuGet Package: DevExpress.Wpf.PivotGrid

Declaration

public PivotOlapMember GetFieldValueOlapMember(
    PivotGridField field,
    int lastLevelIndex
)

Parameters

Name Type Description
field PivotGridField

A PivotGridField object that represents the pivot grid field.

lastLevelIndex Int32

An integer value that specifies the cell’s index.

Returns

Type Description
PivotOlapMember

The PivotOlapMember object. null (Nothing) if the specified summary cell doesn’t correspond to the specified field’s value.

Remarks

If the field parameter specifies the row field, the lastLevelIndex parameter specifies the summary cell’s vertical position (within a column). If the field parameter specifies the column field, the lastLevelIndex parameter specifies the summary cell’s horizontal position (within a row).

pivotgrid_getfieldvalue

Example

The following example demonstrates how to implement Sorting by Summary in OLAP mode.

In this example, values of the Semester field are sorted by the Australia | Bendigo column summary values. To do this, two sort conditions represented by SortByCondition instances are created. One of them represents an OLAP member that corresponds to the ‘Australia’ value, while another corresponds to the ‘Bendigo’ value. These sort conditions are added to the Semester field’s PivotGridField.SortByConditions collection to specify the column by which Semester values should be sorted. A data field that identifies the column is specified via the PivotGridField.SortByField property.

OLAP members corresponding to the Australia and Bendigo values are obtained using the PivotGridControl.GetFieldValueOlapMember method. Note that OLAP members can be obtained only for visible field values. For this reason, the Australia field value is expanded before initializing OLAP members in order to obtain the Bendigo OLAP member.

This sample uses the Adventure Works 2008 cube.

<Window xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="DXPivotGrid_OLAPSortBySummary.MainWindow"
        Height="600" Width="800" Title="Main Window">
    <Grid>
        <dxpg:PivotGridControl Name="pivotGridControl1" Loaded="pivotGridControl1_Loaded">
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField Name="fieldMonth" Area="RowArea" Caption="Month"
                                     FieldName="[Date].[Month of Year].[Month of Year]"/>
                <dxpg:PivotGridField Name="fieldCountry" Area="ColumnArea" Caption="Country"
                                     FieldName="[Customer].[Country].[Country]"/>
                <dxpg:PivotGridField Name="fieldSales" Area="DataArea" Caption="Sales"
                                     FieldName="[Measures].[Internet Sales Amount]"/>
                <dxpg:PivotGridField Name="fieldCity" Area="ColumnArea" Caption="City"
                                     FieldName="[Customer].[City].[City]"/>
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>
See Also