Connecting to OLAP Cubes
- 3 minutes to read
The Dashboard Designer has the capability to connect to an OLAP cube in the Microsoft Analysis Services database using the Data Source wizard or in code. You can either allow end users to manually specify connection parameters or supply a set of predefined OLAP data connections.
To connect to an OLAP cube in the Dashboard Designer, follow the steps below.
Click the New Data Source button in the Data Source ribbon tab.
On the first page of the invoked Data Source Wizard dialog, select Olap and click Next.
On the next page, choose the required Connection type. The following types are available:
Server
If you select Server, the following options are available:
Server name
Specify the name of the OLAP server to which the connection should be established.
UserId
Specify the user name used to authenticate to the OLAP server.
Password
Specify the password used to authenticate to the OLAP server.
Catalog
Select a data catalog that contains cubes.
Cube Name
Select a cube that supplies OLAP data.
Click Finish to create a data source.
Local Cube File
If you select Local cube file, specify the path to the required OLAP cube. To locate the cube, click the ellipsis button next to the Database field.
Click Finish to create a data source.
Custom Connection String
If you select Custom connection string, specify a connection string in the Custom connection string editor.
Click Finish to create a data source.
Creating a Data Source in Code
To create a data source that uses a connection to an OLAP cube, create a DashboardOlapDataSource class instance and perform these steps.
Create an OlapConnectionParameters class object and specify the DashboardOlapDataSource.ConnectionString property.
Pass the resulting OlapConnectionParameters object to the DashboardOlapDataSource constructor.
Note
As an alternative, you can add a connection string with required parameters to the application configuration file. Then, assign the connection string name to the DashboardOlapDataSource.ConnectionName property.
- Add the created DashboardOlapDataSource object to the Dashboard.DataSources collection.
The following code snippet shows how to supply the dashboard with data from the Adventure Works cube deployed on the OLAP server.
using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
// ...
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = "Provider=MSOLAP;Data Source=localhost;Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100";
DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource(olapParams);
dashboard.DataSources.Add(olapDataSource);