Dimension(String, Int32) Constructor

Initializes a new instance of the Dimension class with the specified group index and binds it to the specified data member.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v20.2.Core.dll


public Dimension(
    string dataMember,
    int groupIndex
Public Sub New(
    dataMember As String,
    groupIndex As Integer


Name Type Description
dataMember String

A String that identifies the data member to which this Dimension should be bound. This value is assigned to the DataItem.DataMember property.

groupIndex Int32

An integer value that specifies the index of the group which owns this Dimension. This value is assigned to the Dimension.GroupIndex property.


The data member identifier passed via the dataMember parameter should consist of the data table name and the column name, dot separated. For instance, the Street Address column from the Customers table is identified as "Customers.Street Address".

If a data source has been specified in code, particular data fields can be custom objects. In this instance, the identifier is a chain of property names, like "Customers.City.Population".

Note that aliases specified in the Query Builder are not used in data member identifiers. Use actual column names instead.


You can use the groupIndex parameter to combine the dimensions contained in a specific OLAP hierarchy.


The following example demonstrates how to bind the dashboard to the OLAP cube using DashboardOlapDataSource.

DashboardOlapDataSource allows you to establish a connection to the OLAP cube by specifying a connection string.

View Example

Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.ConnectionParameters

Namespace Dashboard_OlapDataProvider
    Partial Public Class Form1
        Inherits RibbonForm

        Public Sub New()

'            #Region "#OLAPDataSource"
            Dim olapParams As New OlapConnectionParameters()
            olapParams.ConnectionString = "provider=MSOLAP;" _
                                & ControlChars.CrLf & _
                                "data source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" _
                                & ControlChars.CrLf & _
                                "initial catalog=Adventure Works DW Standard Edition;" _
                                & ControlChars.CrLf & _
                                "cube name=Adventure Works;"

            Dim olapDataSource As New DashboardOlapDataSource(olapParams)

'            #End Region ' #OLAPDataSource

        End Sub

        Private Sub InitializeDashboardItems()
            Dim olapDataSource As IDashboardDataSource = dashboardDesigner1.Dashboard.DataSources(0)

            Dim pivot As New PivotDashboardItem()
            pivot.DataSource = olapDataSource
            pivot.Values.Add(New Measure("[Measures].[Sales Amount]"))
            pivot.Columns.Add(New Dimension("[Sales Channel].[Sales Channel].[Sales Channel]"))
            pivot.Rows.AddRange(New Dimension("[Sales Territory].[Sales Territory].[Group]", 1), _
                                New Dimension("[Sales Territory].[Sales Territory].[Country]", 1), _
                                New Dimension("[Sales Territory].[Sales Territory].[Region]", 1))
            pivot.AutoExpandRowGroups = True

            Dim chart As New ChartDashboardItem()
            chart.DataSource = olapDataSource
            chart.Arguments.Add(New Dimension("[Sales Territory].[Sales Territory].[Country]"))
            chart.Panes.Add(New ChartPane())
            Dim salesAmountSeries As New SimpleSeries(SimpleSeriesType.Bar)
            salesAmountSeries.Value = New Measure("[Measures].[Sales Amount]")

            dashboardDesigner1.Dashboard.Items.AddRange(pivot, chart)
        End Sub
    End Class
End Namespace
See Also