TM1, and TI in particular has quite a lot of inbuilt functions but occasionally they miss a few (ELISANC in Excel for one). Although TI has DIMSIZ to count the number of elements in a dimension, there is nothing to count the number of dims in a cube. When trying to recreate a cube via TI, thats a pain because you need to know how many dims to create it with to be able to write a "CubeCreate" statement.
Below is a short piece of code that works that out for you;
Code: Select all
DimMax = 16; DimLast = TabDim ( CubeName , DimMax ); While ( DimLast @= '' ); DimMax = DimMax - 1; DimLast = TabDim ( CubeName , DimMax ); End;
- DimMax is set to 16 because i know we don't have any cubes bigger than that. If you do, then just set that higher.
- CubeName is a variable within the TI, in my case it's from a dimension subset that's the datasource for the TI.