clsCubeLevel
Ostrzeżenie
Ta funkcja zostanie usunięta z następnej wersji programu Microsoft SQL Server. Nie należy stosować tej funkcji w nowych projektach oraz jak najszybciej należy zmodyfikować aplikacje, w których obecnie jest używana ta funkcja.
Obiekt ClassType clsCubeLevel zawiera określonej implementacji Decision Support Objects (DSO) Level interfejs.Ten obiekt zawiera kolekcje i właściwości za pomocą Level interfejs.Ma skojarzony obiekt ClassType clsCubeLevel.
Uwagi
Po przypisaniu wymiaru w bazie danych do modułu, moduł dziedziczy wszystkie poziomy wymiar.Obiekt ClassType clsCubeLevel umożliwia dostęp do tych poziomów.Ponieważ nie wszystkie wymiary bazy danych niekoniecznie ma zastosowanie do danego moduł, jedną z zalet dostęp bezpośrednio do poziomów moduł jest uniknięcie przechodzenie wymiary i poziomy całej bazy danych do określania poziomów, które są używane w module.
Przykład
Do tworzenia wymiar i poziomów dla bazy danych i zastosować je do moduł, należy użyć następującego kodu:
'Assume an object (dsoDB) of ClassType clsDatabase exists
'with an existing data source
Dim dsoDim As DSO.Dimension
Dim dsoLevel As DSO.Level
Dim dsoDS As DSO.Datasource
'Add a dimension and levels to the database
Set dsoDS = dsoDB.Datasources(1)
Set dsoDim = dsoDB.Dimensions.AddNew("Products")
Set dsoDim.DataSource = dsoDS 'Dimension DataSource
dsoDim.FromClause = "product" 'Source Table
'Add a Product Brand Name level
Set dsoLev = dsoDim.Levels.AddNew("Brand Name")
dsoLev.MemberKeyColumn = """product"".""brand_name"""
dsoLev.ColumnSize = 255
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 100
'Add a Product Name level
Set dsoLev = dsoDim.Levels.AddNew("Product Name")
dsoLev.MemberKeyColumn = """product"".""product_name"""
dsoLev.ColumnSize = 255
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 1560
dsoDim.Update
'Add additional dimensions and levels as required
...
'Add cube to database
Dim dsoCube As MDStore
Set dsoCube = dsoDB.MDStores.AddNew(strCubeName)
'Create and configure a DataSource object for the cube
Set dsoDS = dsoDB.DataSources(1)
dsoCube.DataSources.AddNew (dsoDS.Name)
'Set source fact table and estimated rows in fact table
dsoCube.SourceTable = """sales_fact_1998"""
dsoCube.EstimatedRows = 1000
'Add shared database dimensions
'Cube inherits dimension levels
dsoCube.Dimensions.AddNew ("Products")
'Add other shared or private dimensions
Zobacz także