Exploring OLAP Cube with Visual Basic - Properties of Levels
(Page 6 of 6 )
The following code accesses the levels in the dimensions of the cube.
oCn.Open "Provider=MSOLAP;Data Source=NECHOST; Initial Catalog=NewOlap;"
Set oCat.ActiveConnection = oCn
Dim strAll As String
strAll = ""
Text1.Text = "Name of Catalog: " & oCat.Name
strAll = oCat.Name
Text2.Text = "Name of Active Connection: " & vbCrLf & oCat.ActiveConnection
strAll = strAll & "," & oCat.ActiveConnection
Debug.Print strAll
Set ocube = oCat.CubeDefs("MyFirstCube")
Dim strDim As String
For Each ocdim In ocube.Dimensions
Debug.Print strDim & ocdim.Name & "," &
ocdim.Hierarchies(0).Levels(0).Members(0).LevelName
'Debug.Print ocdim.Name
List1.AddItem ocdim.Name
List1.AddItem ocdim.Hierarchies(0).Levels(0).Members(0).LevelName
Next ocdim
The result of running the above code produces the following output:
NewOlap,Provider=MSOLAP.2;Data Source=NECHOST;
Initial Catalog=NewOlap;Client Cache Size=25;Auto Synch Period=10000
Measures,[Measures].[MeasuresLevel]
MyCustomers,[MyCustomers].[(All)]
MyOrders,[MyOrders].[(All)]
MyProducts,[MyProducts].[(All)]
Summary
The objects and collections investigated in this tutorial are shown in the next picture. This is a partial view of the ADOMD's API. The positional information of Members in a cell will be investigated in the next tutorial.

| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |