DimensionElementInsert TM1 Function: Use and Syntax

DimensionElementInsert, as you would expect, inserts a new element into a dimension in TM1. It could have been written as DimensionElementAdd, to add an element, but this would have been confusing!

Syntax of DimensionElementInsert

The syntax:

DimensionElementInsert (Dimension, InsertionPoint, ElName, ElType);

where:

Dimension refers to the dimension to which you want to add a new element.
InsertionPoint is an existing dimension element. The element being added to the dimension will be inserted immediately before this existing element. If this parameter is empty, the new element is added to the end of the dimension.
ElName is the name you want to assign to the new element.
ElType is the element type. There are three possible ElType values, namley:

  • N – for a numeric element.
  • S – for a string element.
  • C – for a consolidated element.

Example and Usage

DimensionElementInsert ('GL Account', '', vSub_Account, 'n');

This will insert the defined value of the variable vSub_Account into the dimension GL Account at the very end (the empty single quotes) as an “N” level element.

Combined Example to Add a New Element and Consolidate

DimensionElementInsert is often used in combination with an IF statement along with a DIMIX statement to test if an element exists in a dimension. We then insert if it does not exist and use a DimensionElementComponentAdd statement to then add it into a hierarchy.

If we were including it in a Turbo Integrator process to check if it exists and then add it if it doesn’t and roll it up into a parent, the TI process would look like this:

DimName = 'Test';

IF ( DIMIX ( DimName , pNew ) = 0);
  DimensionElementInsert ( DimName , pInsertAfter, pNew , 'N' );
ENDIF;

DimensionElementComponentAdd ( DimName , pParent , pNew , pWeight);

Notes

If you are looking to add an element to a parent, rather than insert an element into a dimension, please use DimensionElementComponentAdd.

This function is the opposite of DimensionElementDelete, which you can use to delete an element from a dimension.

This function can only be used in Turbo Integrator processes.

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.

6 comments on “DimensionElementInsert TM1 Function: Use and Syntax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.