Skip to main content

How to: Bind a PivotGrid to an OLAP Cube with XMLA

The following example demonstrates how to bind a PivotGridControl to an OLAP cube via the XMLA data access standard.

In this example, the PivotGridControl.OlapDataProvider property is used to specify that PivotGridControl should use the XMLA data access standard to access an OLAP cube. OLAP connection parameters are specified in a connection string passed to the PivotGridControl.OlapConnectionString property. The following parameters are provided:

  • Data Source - a path to a data pump.
  • Initial Catalog - a data catalog that contains cubes.
  • Cube Name - the name of the cube that provides OLAP data.
<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_XMLASupport.MainWindow"
        Title="MainWindow" Height="300" Width="640">
    <Grid>
        <dxpg:PivotGridControl x:Name="pivotGridControl1" OlapDataProvider="Xmla">
            <dxpg:PivotGridControl.OlapConnectionString>
                Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;
                Initial Catalog=Adventure Works DW Standard Edition;
                Cube Name=Adventure Works;
            </dxpg:PivotGridControl.OlapConnectionString>
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField FieldName="[Measures].[Internet Sales Amount]" 
                                     Caption="Sales Amount" Area="DataArea" />
                <dxpg:PivotGridField FieldName="[Customer].[Country].[Country]"
                                     Caption="Country" Area="RowArea" />
                <dxpg:PivotGridField FieldName="[Date].[Fiscal].[Fiscal Year]"
                                     Caption="Fiscal Year" Area="ColumnArea" />
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>