DimensionElementDelete Function TM1: Syntax and Use
Here is how to simply delete a single element from a dimension in TM1. Note DimensionElementDelete permanently deletes the element from the TM1 dimension and all associated data from any cube the dimension is in – so please be careful!
Syntax of DimensionElementDelete
The syntax is:
DimensionElementDelete ( dimension , element ) ;
- dimension – is the name of the dimension that you want to delete an element from
- element – is the name of the element that you want to delete from the dimension
DimensionElementDelete ( 'Product', 'Shoes');
This example deletes the element ‘Shoes’ from the ‘Product’ dimension.
Often we will use this function alongside the DIMIX and IF functions, so we end up with TI code that looks like this:
DimName = 'Product'
Element = 'Shoes'
IF ( DIMIX ( DimName , Element ) > 0 );
DimensionElementDelete ( DimName , Element ) ;
This sets up the variables for the dimension name and element, then uses DIMIX to check if the element exists in the dimension and if it does, then it deletes it.
As stated above, this function will delete the element from the dimension and all data associated with the element in any cube where it is used.
If you are looking to delete an element from a parent, but leave the element still in the dimensions, just not as a child to the parent, please use DimensionElementComponentDelete.
This function is the opposite of DimensionElementInsert.