Using the DimensionCreate Function to Create a Dimension in TM1
Often we will want to create dimensions in TM1. We might be creating a new model or recreating a dimension during a TI process. To do this we use the DimensionCreate function (not the CreateDimension function that doesn’t exist!).
Syntax of DimensionCreate
The syntax is DimensionCreate ( DimName );
where DimName represents the name of the dimension you want to create.
DimensionCreate ( ‘Customer’ );
This example creates the Customer dimension in our TM1 model.
This function is often used in conjunction with an IF statement and the DimensionExists function to check if a dimension exists and if it doesn’t, then to create it. This could look like:
sDimName = 'Customer' ; IF ( DimensionExists ( sDimName ) = 0 ) ; DimensionCreate ( sDimName ) ; ENDIF ;
In this example we are setting the variable sDimName as ‘Customer’, then testing if it exists and if not, then creating it.
You can only use this function in TI processes.