Giter Club home page Giter Club logo

wpf-pivot-grid-connect-to-an-olap-datasource's Introduction

Pivot Grid for WPF - How to Connect a Pivot Grid to an OLAP Data Source

The Pivot Grid can display data from the the OLAP server (Microsoft Analysis Services). This example shows how to specify connection settings to the server and create fields that relate to specific measures and dimensions of the cube.

To bind the Pivot Grid control to an OLAP cube, follow the steps below.

  1. Specify connection settings to the server. You can do it in the Items Source Wizard. The following code shows the resulting XML:

    <!-- xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" -->
     <Window.Resources>
         <dx:PivotOlapDataSource x:Key="PivotOlapDataSource" Cube="Adventure Works" 
                                 Catalog="Adventure Works DW Standard Edition" ConnectionTimeout="60" 
                                 LocaleIdentifier="1033" Password="{x:Null}" Provider="MSOLAP" 
                                 QueryTimeout="30" Server="http://demos.devexpress.com/Services/OLAP/msmdpump.dll" 
                                 UserId="{x:Null}">
         </dx:PivotOlapDataSource>
     </Window.Resources>
  2. Bind the Pivot Grid to data. Set the PivotGridControl.OlapDataProvider to ADOMD and assign the connection string to the PivotGridControl.OlapConnectionString property.

    <!-- xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid" -->
     <Grid>
         <dxpg:PivotGridControl Name="pivotGridControl1" RowTreeMinWidth="170"
                                OlapDataProvider="Adomd" 
                                OlapConnectionString="{Binding ConnectionString, Source={StaticResource PivotOlapDataSource}}" />
     </Grid>
  3. Create fields for all the measures and dimension in the bound OLAP cube, and move these fields to the specified area to make them hidden. To do it, use the PivotGridControl.RetrieveFields method overload with the visible parameter and set the field's visibility to false. The RetrieveFields method generates DataSourceColumnBinding objects for each Pivot Grid field in OLAP, Server, and Optimized modes.

    public MainWindow() {
          InitializeComponent();
    
          // Retrieves fields.
          pivotGridControl1.RetrieveFields(FieldArea.ColumnArea, false);
    }
  4. Place the created fields within corresponding Pivot Grid Control areas and set their PivotGridField.Visible property to true.

    public MainWindow() {
       // ...
    
       // Adds some fields from the Field List to the specified area to create a report.
       pivotGridControl1.Fields["[Customer].[Country].[Country]"].Area = FieldArea.RowArea;
       pivotGridControl1.Fields["[Customer].[Country].[Country]"].Visible = true;
       pivotGridControl1.Fields["[Customer].[City].[City]"].Area = FieldArea.RowArea;
       pivotGridControl1.Fields["[Customer].[City].[City]"].Visible = true;
       pivotGridControl1.Fields["[Date].[Fiscal].[Fiscal Year]"].Area = FieldArea.ColumnArea;
       pivotGridControl1.Fields["[Date].[Fiscal].[Fiscal Year]"].Visible = true;
       pivotGridControl1.Fields["[Measures].[Internet Sales Amount]"].Visible = true;
    }

    Use the invoked Customization Form to manage the Pivot Grid control's layout.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

wpf-pivot-grid-connect-to-an-olap-datasource's People

Contributors

devexpressexamplebot avatar natakazakova avatar ritazakhodyaeva avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.