Database
  Home arrow Database arrow Page 5 - Exploring OLAP Cube with Visual Basic
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE

Exploring OLAP Cube with Visual Basic
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 21
    2005-08-18

    Table of Contents:
  • Exploring OLAP Cube with Visual Basic
  • Measures and Dimensions: Cube details under investigation
  • Using VB to Explore the OLAP Cube: Creating a VB Project
  • Properties of the Cube: Properties of Dimensions
  • Properties of Hierarchies
  • Properties of Levels

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Exploring OLAP Cube with Visual Basic - Properties of Hierarchies


    (Page 5 of 6 )

    A hierarchy is the set of members in a dimension and their position relative to one another. The following code loops through the various properties of the hierarchies. The first dimension is the Measures and the properties of the first of its hierarchy are looped through.

    Private Sub Command2_Click()
    oCn.Open "Provider=MSOLAP;Data Source=NECHOST; & _
    Initial Catalog=NewOlap;"
    Set oCat.ActiveConnection = oCn
    Set ocube = oCat.CubeDefs(0)
    Set ocdim = oCat.CubeDefs(0).Dimensions(0)
    Set ohr = ocube.Dimensions(0).Hierarchies(0)
    Dim chrt As String
    'the name of the first dimension
    chrt = ocube.Dimensions(0).Name
    Debug.Print chrt & vbCrLf & "-------"
    Dim chrhr As String
    chrhr = ohr.Name
    Debug.Print chrhr
    Debug.Print "-----"
    Dim cnt
    cnt = ocube.Dimensions(0).Hierarchies(0).Properties.Count
    Debug.Print cnt
    Dim i
    For i = 0 To cnt - 1
    Debug.Print ocube.Dimensions(0).Hierarchies(0). & _
    ; Properties(i).Name & "," _
    ; ocube.Dimensions(0).Hierarchies(0).Properties(i).Type & "," _
    ; ocube.Dimensions(0).Hierarchies(0).Properties(i).Value
    Next i
    End Sub
    

    The result of running this code is shown next.

    Measures
    -------
    -----
    21 
    CATALOG_NAME,202,NewOlap
    SCHEMA_NAME,202,Null
    CUBE_NAME,202,MyFirstCube
    DIMENSION_UNIQUE_NAME,202,[Measures]
    HIERARCHY_NAME,202,Null
    HIERARCHY_UNIQUE_NAME,202,[Measures]
    HIERARCHY_GUID,72,Null
    HIERARCHY_CAPTION,202,Measures
    DIMENSION_TYPE,2, 2 
    HIERARCHY_CARDINALITY,19, 3 
    DEFAULT_MEMBER,202,[Measures].[Unit Price]
    ALL_MEMBER,202,Null
    DESCRIPTION,202,Null
    STRUCTURE,2, 0 
    IS_VIRTUAL,11,False
    IS_READWRITE,11,False
    DIMENSION_UNIQUE_SETTINGS,3, 0 
    DIMENSION_MASTER_UNIQUE_NAME,202,Null
    DIMENSION_IS_VISIBLE,11,True
    HIERARCHY_ORDINAL,19, 0 
    DIMENSION_IS_SHARED,11,False
    
    Properties of Members

    The following code accesses the member properties of the Measures[Dimensions(0)].

    Private Sub Command3_Click()
    oCat.ActiveConnection = "Provider=MSOLAP; " & _
    "Data Source=NECHOST; Initial Catalog=NewOlap;"
    Set oMem = oCat.CubeDefs(0).Dimensions(0).Hierarchies(0).Levels(0).Members
    Debug.Print oCat.CubeDefs(0).Dimensions(0).Name
    Dim cnt
    cnt = oMem.Count
    Debug.Print cnt
    Dim j
    For j = 0 To cnt - 1
    Debug.Print oMem.Item(j).Properties(j).Name & "," _
    ; oMem.Item(j).Properties(j).Type & "," _
    ; oMem.Item(j).Properties(j).Value & "," _
    ; oMem.Item(j).Caption & "," _
    ; oMem.Item(j).LevelName
    Next j
    End Sub
    

    The result of running this code is shown next. There are four items for which the New Calculated Member is not a data member (Is_DataMember is False). Please refer to the Schema shown earlier. The members of the Measures are shown in the next picture.

    Measures
    4 
    EXPRESSION,202,,Unit Price,[Measures].[MeasuresLevel]
    MEMBER_KEY,202,,Quantity,[Measures].[MeasuresLevel]
    IS_PLACEHOLDERMEMBER,11,False,Discount,[Measures].[MeasuresLevel]
    IS_DATAMEMBER,11,False,New Calculated Member,[Measures].[MeasuresLevel]
    

    The same code, now run for Dimension(2) returns the following. All MyOrders is a system-generated member of the (All). Being system generated it is not in the MyOrders dimension table.

    MyOrders
    1
    EXPRESSION,202,,All MyOrders, [MyOders].[(All)]
    

    More Database Articles
    More By Jayaram Krishnaswamy


       · You are welcome to comment. Hierearchy is a big deal in OLAP. There are two aspects...
       · You article about Olap (cubes) with VB (6.0) was very interesting. I'm thinking if...
       · Right now I do not have one, but I have been planning on writing a sequel. However,...
       · Is there a way in .NET to programmatically create a new dimension for an existing...
     

    DATABASE ARTICLES

    - Excel Reference
    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client
    - ADO`s Stream Object
    - Opening a Record Object Referencing an Open ...
    - Introducing Jasper (SQL Anywhere 10 Beta)
    - Creating a Database Project in VS 2005

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT