a·gen·tic a·gil·i·ty

Get Analysis Services last processed date

TL;DR; Provides code to retrieve the last processed date of cubes on an Analysis Services server, highlighting performance considerations and error handling in .NET environments.

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

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

 1Public Function GetCubeLastProcessedDates(ByVal AnalysisServer As String) As Collection(Of CubeInfo)
 2    Dim result As Collection(Of CubeInfo)
 3    Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
 4    Dim eCode As Integer = CommonUtility.RevertToSelf()
 5    Dim oServer As New Server
 6    Try
 7        result = New Collection(Of CubeInfo)
 8        oServer.Connect(String.Format(CultureInfo.InvariantCulture, "data Source = {0};", AnalysisServer))
 9
10        For Each d As Database In oServer.Databases
11            For Each c As Cube In d.Cubes
12                result.Add(New CubeInfo(d.Name, c.Name, c.LastProcessed))
13            Next
14        Next
15
16        oServer.Disconnect()
17    Catch e As ConnectionException
18        ' Do some error handling
19    Catch e As AdomdErrorResponseException
20        ' Do some error handling
21    Catch e As AdomdConnectionException
22        ' Do some error handling
23    Catch e As Microsoft.AnalysisServices.AmoException
24        ' Do some error handling
25    Catch e As Exception
26        Throw
27    Finally
28        oServer.Dispose()
29        identity.Impersonate()
30    End Try
31    '------------------------------
32    Return result
33End 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

Subscribe

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.​

Deliotte Logo

Deliotte

Schlumberger Logo

Schlumberger

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

ALS Life Sciences Logo

ALS Life Sciences

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Healthgrades Logo

Healthgrades

NIT A/S

YearUp.org Logo

YearUp.org

Epic Games Logo

Epic Games

Slicedbread Logo

Slicedbread

Emerson Process Management Logo

Emerson Process Management

Akaditi Logo

Akaditi

SuperControl Logo

SuperControl

CR2

Brandes Investment Partners L.P. Logo

Brandes Investment Partners L.P.

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Kongsberg Maritime Logo

Kongsberg Maritime

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Washington Department of Transport Logo

Washington Department of Transport

Royal Air Force Logo

Royal Air Force

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Nottingham County Council Logo

Nottingham County Council

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

DFDS Logo

DFDS

Big Data for Humans Logo

Big Data for Humans

Illumina Logo

Illumina

ProgramUtvikling Logo

ProgramUtvikling

CR2

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.