Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Collapse]Examples
    [Collapse]Providing Data
      How to: Bind a PivotGridControl to a Database
      How to: Bind a Pivot Grid to an OLAP Datasource
      How to: Bind a PivotGridControl to an OLAP Cube Using the OLE DB Data Provider
      How to: Bind a PivotGridControl to an OLAP Cube Using the ADOMD.NET Data Provider
      How to: Bind a PivotGridControl to an OLAP Cube via XMLA
      How to: Add an Unbound Field to Supply Additional Data
      How to: Add an Unbound Field to Change Axis Detailing
      How to: Provide Data for an Unbound Field Using Expressions
      How to: Save PivotGridControl Data to a File and Work with It Later
      How to: Bind a PivotGridControl to a Database at Design Time Using Server Mode
    [Expand]Data-Related Features
    [Expand]Data Editing
    [Expand]Layout Features
    [Expand]Data Formatting
    [Expand]Data Output
    [Expand]Appearance
    [Expand]Miscellaneous
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Bind a PivotGridControl to an OLAP Cube Using the OLE DB Data Provider

The following example shows how to view data from an OLAP server (MS SQL Server 2008 R2 Analysis Services) in the PivotGridControl.

Expanded Prerequisites

In the example, the Pivot Grid Control is bound to an Adventure Works cube in the MS SQL Server 2008 R2 Analysis Services (SSAS). It's assumed that you have the standard AdventureWorksDW (data warehouse) database installed and the Adventure Works cube was deployed to your instance of MS SQL Server 2008 R2. By default, this database and the cube are not installed.

Expanded Displaying Data in the Pivot Grid Control - Design-Time Example

The steps below show how to view data from the Adventure Works cube in the PivotGridControl.

  1. Create a new Windows Forms application project in Visual Studio.

  2. Place the PivotGridControl on the main form and select it in the Properties window.

  3. In the Properties window, focus the PivotGridControl.OLAPConnectionString property and click the ellipsis (...) button. This will invoke the Connection String Editor.

  4. In the editor, specify the connection settings to the cube. First, specify a data provider to be used (MSOLAP). Specify the server name that runs the required instance of SSAS (type "localhost" if the local MS SQL Server 2008 R2 is used). Then, click the dropdown button in the Catalog Name edit box. This should list the names of all data catalogs that exist on the specified instance of SSAS. Select the "Adventure Works DW Standard Edition" item.

    Click the dropdown button in the Cube Name edit box to open the list of available cubes in the specified catalog. Select the "Adventure Works" cube.

    Click the OK button to submit the connection settings.

  5. Run the PivotGrid Designer by right-clicking on the control and selecting the Run Designer option. The Fields page will be opened.

  6. Ensure that the Field List pane that displays all available fields in the bound cube is visible. If the pane is hidden, click the Show Field List button at the top of the designer.

  7. Locate the "[Measures].[Internet Sales Amount]" field in the Field List pane. This field will be represented by a Data Field in the PivotGridControl.

    To create a PivotGridField object for this field, drag the "[Measures].[Internet Sales Amount]" item onto the PivotGrid Fields pane (or simply double-click it within the Field List pane).

    To position the created field within the Data Header Area, set the field's PivotGridFieldBase.Area property to the PivotArea.DataArea value in the Properties grid.

  8. Locate the "[Customer].[Country].[Country]" field in the Field List pane. This field will be represented by a Row Field in the PivotGridControl.

    Drag this field onto the PivotGrid Fields list and set the created PivotGridField's PivotGridFieldBase.Area property to the PivotArea.RowArea value.

  9. Locate the "[Date].[Fiscal Year].[Fiscal Year]" field in the Field List pane. This field will be represented by a Column Field in the PivotGridControl.

    Drag this field onto the PivotGrid Fields list. The created PivotGridField's PivotGridFieldBase.Area property will be already set to the PivotArea.ColumnArea value. Leave this value unchanged.

  10. Close the designer. The Pivot Grid Control will display three fields in the Data, Column and Row areas respectively.

  11. Run the project. The form will look like the image below, showing data retrieved from the Adventure Works cube.

Expanded Displaying Data in Pivot Grid Control - Runtime Example

The following code shows how to view data from the Adventure Works cube at runtime. It's equivalent to the design-time steps from the previous section.

How would you rate this topic?​​​​​​​