Sunday, August 30, 2009

Essbase VBA toolkit: Getting different alias tables via EssVGetMemberInfo

There was a recent post on the OTN forum asking this simple question:

This code is getting a default alias:

at = EssVGetMemberInfo(Null, "Product", EssBottomLevel, True)

How do I get a 2nd aliase?

There is a pretty simple answer to this question. Essbase can only have one alias table 'active' at one time for a particular connection and the EssVGetMemberInfo function uses that alias table. Thus, to get the aliases from a different alias table, you need to set the alias table programmatically. Here is an example of how to do it:


Sub GetAliases()
Option Explicit

Sub GetAliases()
  Dim v As Variant
  Dim v2 As Variant

  ''' set alias table to default
  EssVSetSheetOption Null, 14, "Default"

  ''' get the aliases
  v = EssVGetMemberInfo(Null, "Product", _
      EssBottomLevel, True)
  v2 = EssVGetMemberInfo(Null, "Year", _
      EssBottomLevel, True)

  Stop ''' look at the arrays here; product has aliases

  ''' set alias table to default
  EssVSetSheetOption Null, 14, "Long Names"

  ''' get the aliases
  v = EssVGetMemberInfo(Null, "Product", _
      EssBottomLevel, True)
  v2 = EssVGetMemberInfo(Null, "Year", _
      EssBottomLevel, True)

  Stop ''' look at the arrays here; year has aliases
End Sub


When we engineered Dodeca, we looked at how people used different alias tables and included an alias table argument where appropriate in order to make it easier.

No comments: