tech·nic·al·ly agile

Get Analysis Services last processed date

Discover how to retrieve the last processed date for your SSAS cubes with this essential code snippet. Enhance your data analysis efficiency today!

Published on
1 minute read
Image
https://nkdagility.com/resources/_Pa-Z4LIvzg

I need a little bit of code to get the last processed date for the cube that my site connects to:

Public Function GetCubeLastProcessedDates(ByVal AnalysisServer As String) As Collection(Of CubeInfo)
    Dim result As Collection(Of CubeInfo)
    Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
    Dim eCode As Integer = CommonUtility.RevertToSelf()
    Dim oServer As New Server
    Try
        result = New Collection(Of CubeInfo)
        oServer.Connect(String.Format(CultureInfo.InvariantCulture, "data Source = {0};", AnalysisServer))

        For Each d As Database In oServer.Databases
            For Each c As Cube In d.Cubes
                result.Add(New CubeInfo(d.Name, c.Name, c.LastProcessed))
            Next
        Next

        oServer.Disconnect()
    Catch e As ConnectionException
        ' Do some error handling
    Catch e As AdomdErrorResponseException
        ' Do some error handling
    Catch e As AdomdConnectionException
        ' Do some error handling
    Catch e As Microsoft.AnalysisServices.AmoException
        ' Do some error handling
    Catch e As Exception
        Throw
    Finally
        oServer.Dispose()
        identity.Impersonate()
    End Try
    '------------------------------
    Return result
End Function

The only problem I have with this is that while it takes no longer than 5 seconds to return a negative result, it can take as much as 30 seconds to return when in the positive (i.e. you can access the cube).

This makes it a threading only, and more than that, a nice to have only. If this is critical information then you will just have to wait…

Technorati Tags: .NET 

Software Development
Comments

Related blog posts

No related videos found.

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Lockheed Martin Logo

NIT A/S

Boxit Document Solutions Logo
Healthgrades Logo

CR2

DFDS Logo
Genus Breeding Ltd Logo
Deliotte Logo
ALS Life Sciences Logo
New Signature Logo
Kongsberg Maritime Logo
Schlumberger Logo
Slicedbread Logo
Big Data for Humans Logo
Milliman Logo
YearUp.org Logo
Higher Education Statistics Agency Logo
Qualco Logo
Washington Department of Enterprise Services Logo
Ghana Police Service Logo
Royal Air Force Logo
New Hampshire Supreme Court Logo
Washington Department of Transport Logo
Department of Work and Pensions (UK) Logo
Higher Education Statistics Agency Logo
Illumina Logo
YearUp.org Logo
Big Data for Humans Logo
Graham & Brown Logo
Trayport Logo