Checking if a DimensionExists in a TM1 Model
Sometimes we need to check if a dimension exists in a 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.
DimensionExists ( ‘Customer’ ) ;
This example determines if the Customer dimension exists in the current TM1 model and if it does, will return a 1.
It is often used in conjunction with an IF function and possibly DimensionCreate. 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.