Page 1 of 1

Get Dimensions and Elements

Posted: Wed Jan 27, 2010 9:55 pm
by samuvk
Hi all,

I'm new here and with TM1 so I kind of lost.

I'm trying to get all the dimensions that certain cube (Let's say CUBE) has, and at the same time try to get all the elements for a certain dimension (Let's say Month).

Could anyone help me with that issue?

Thank you very much all in advance

Re: Get Dimensions and Elements

Posted: Wed Jan 27, 2010 10:02 pm
by Alan Kirk
samuvk wrote:Hi all,

I'm new here and with TM1 so I kind of lost.

I'm trying to get all the dimensions that certain cube (Let's say CUBE) has, and at the same time try to get all the elements for a certain dimension (Let's say Month).

Could anyone help me with that issue?
Get it how? In a TurboIntegrator process, in an Excel worksheet, in a set of rules statements, via VBA?

For the first request, the function that you need is probably TabDim (which is both a Worksheet function and a Rules function), for the second one you most likely need the DimSiz and DimNm functions.

Re: Get Dimensions and Elements

Posted: Thu Jan 28, 2010 2:30 pm
by samuvk
I would like to get for instance the Dimensions of a cube in a rutine of Visual Basic.

Let say that we have a cube calls (Company), where you have dimensions as: Countries, Year, Month, Net Income (Those are the name of the dimensions)

How could I get those names in a Visual Basic rutine?

Thank you very much again

Re: Get Dimensions and Elements

Posted: Thu Jan 28, 2010 5:34 pm
by Alan Kirk
samuvk wrote:I would like to get for instance the Dimensions of a cube in a rutine of Visual Basic.

Let say that we have a cube calls (Company), where you have dimensions as: Countries, Year, Month, Net Income (Those are the name of the dimensions)

How could I get those names in a Visual Basic rutine?

Thank you very much again
Use Application.Run to execute the TabDim function in a loop until it returns an empty string. (Obviously add error handling and other frills):

Code: Select all

Sub ReturnDimNames()

Dim s_DimName As String
Dim l_DimIdx As Long

l_DimIdx = 1

s_DimName = Application.Run("TabDim", "planning sample:plan_BudgetPlan", l_DimIdx)

If s_DimName = "" Then
    MsgBox "No such cube!"
    Exit Sub
End If

Do While s_DimName <> ""

    MsgBox "Dim " & l_DimIdx & " is " & s_DimName

    l_DimIdx = l_DimIdx + 1

    s_DimName = Application.Run("TabDim", "planning sample:plan_BudgetPlan", l_DimIdx)

Loop

End Sub