DimensionDestroy: How to Delete a Dimension in TM1
Sometimes we want to just delete a dimension from TM1. We get lots of failed searches on our site for DimensionDelete – but unfortunately that doesn’t exist. IBM, in their wisdom, have called the function DimensionDestroy, rather than the logical DimensionDelete.
Syntax of DimensionDestroy
The syntax is very easy:
Where DimName is the name of the dimension you want to delete.
Example of DimensionDelete, sorry, DimensionDestroy!
An example of this function is as follows:
DimName = 'Customer'; DimensionDestroy ( DimName );
The DimensionDestroy function is often used in conjunction with an IF statement and the DimensionExists function to check if a dimension exists and if it does then to delete it. This could look like:
DimName = 'Customer' ; IF ( DimensionExists ( DimName ) = 1 ) ; DimensionDestroy ( DimName ) ; ENDIF ;
In this example we are setting the variable DimName as ‘Customer’, then testing if it exists and if it does, then deleting it.
It could also be used as a rudimentary way of cleaning out everything from a dimension before creating it again with a DimensionCreate. In this case, the code would look like this:
DimName = 'Customer' ; IF ( DimensionExists ( DimName ) = 1 ) ; DimensionDestroy ( DimName ) ; DimensionCreate ( DimName ) ; ENDIF ;
You can only use DimensionDestroy in TI processes.