DimensionExists: Checking if a Dimension is in TM1
Sometimes we need to check if a dimension exists in a TM1 model via Turbo Integrator process. We might want to then build it if it doesn’t exist or unwind the dimension if it does. To do this is really easy with a simple function – DimensionExists.
Syntax of DimensionExists
DimensionExists ( DimName );
where DimName is the name of the dimension you want to check if it exists.
The function will return a “1” if it does exist or a “0” if it doesn’t.
DimName = 'Customer'; DimensionExists ( DimName ) ;
This example we use the DimensionExists function to determine if the Customer dimension exists in the current TM1 model. If it does, the function will return a 1.
DimName = 'Customer' ; IF ( DimensionExists ( DimName ) = 0 ) ; DimensionCreate ( DimName ) ; ENDIF ;
In this example we are setting the variable DimName as ‘Customer’, then testing if it exists using DimensionExists and if not, then creating it with DimensionCreate.
You can only use this function in TI processes.