Skip to main content

ASPxPivotGrid.GetFieldValueOLAPMember(PivotGridField, Int32) Method

Returns an OLAP member for the specified field value.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public IOLAPMember GetFieldValueOLAPMember(
    PivotGridField field,
    int cellIndex
)

Parameters

Name Type Description
field PivotGridField

A PivotGridField object that represents the pivot grid field.

cellIndex Int32

An integer value that specifies the cell’s index.

Returns

Type Description
IOLAPMember

An object that implements the IOLAPMember interface.

Remarks

If the field parameter specifies the row field, the cellIndex parameter specifies the summary cell’s vertical position (within a column). In this instance, provide the absolute index of the row where the cell resides. Use the ASPxPivotGrid.GetAbsoluteRowIndex method to obtain the absolute row index by its index within the current page.

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

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 PivotGridFieldSortCondition 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 PivotGridFieldSortBySummaryInfo.Conditions collection to specify the column by which Semester values should be sorted. A data field that identifies the column is specified via the PivotGridFieldSortBySummaryInfo.Field property.

OLAP members corresponding to the Australia and Bendigo values are obtained using the ASPxPivotGrid.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.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="ASPxPivotGrid_OLAPSortBySummary._Default" %>

<%@ Register Assembly="DevExpress.Web.ASPxPivotGrid.v14.1, Version=14.1.7.0,
    Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPivotGrid"
    TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" DataSourceID="AccessDataSource1"
        OnLoad="ASPxPivotGrid1_Load">
            <Fields>
                <dx:PivotGridField ID="fieldMonth" Area="RowArea" AreaIndex="0"
                Caption="Month" FieldName="[Date].[Month of Year].[Month of Year]">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldCountry" Area="ColumnArea" AreaIndex="0" Caption="Country"
                    FieldName="[Customer].[Country].[Country]">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldCity" Area="ColumnArea" AreaIndex="1" Caption="City"
                    FieldName="[Customer].[City].[City]">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldSales" Area="DataArea" AreaIndex="0" Caption="Sales"
                    FieldName="[Measures].[Internet Sales Amount]">
                </dx:PivotGridField>
            </Fields>
        </dx:ASPxPivotGrid>
    </div>
    </form>
</body>
</html>
See Also