Examples, clsCubeAnalyzer

Option Explicit

Public dsoServer As DSO.Server

Public dsoDB As DSO.MDStore

Public dsoCube As DSO.MDStore

Public dsoCubeAnalyzer As DSO.CubeAnalyzer

Public ADODBRecSet As ADODB.Recordset

Public Sub AnalyzeCube()

    If dsoServer Is Nothing Then

        Set dsoServer = New DSO.Server

        'MyServer is the name of the OLAP server

dsoServer.Connect ("MyServer")

    End If

    

    'Get first database from server

    Set dsoDB = dsoServer.MDStores(1)

    

    'Get first cube from database

    Set dsoCube = dsoDB.MDStores(1)

    

    'Get analyzer object from cube

    Set dsoCubeAnalyzer = dsoCube.Analyzer

    

    'Get Recordset from log

    Set ADODBRecSet = dsoCubeAnalyzer.OpenQueryLogRecordset _

      ("SELECT * FROM QueryLog WHERE Duration < 5")

      

    If ADODBRecSet.BOF And ADODBRecSet.EOF Then

        Debug.Print "<<No records in query log>>"

    Else

        ADODBRecSet.MoveLast

       Debug.Print "   Record count: " & ADODBRecSet.RecordCount

    End If

End Sub

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.