Exploring TM1 - a Chartertech Company
Close this search box.

DimensionElementComponentAddDirect TM1 Function: How to Use, Examples and Syntax

DimensionElementComponentAddDirect adds an existing element in a TM1 dimension into a hierarchy as a child of another element immediately.  In other words, it is used to create rollups as the command is executed, rather than waiting until the current step (Prolog, Metadata, Data or Elipog) is complete..

Syntax of DimensionElementComponentAddDirect

The syntax is:

DimensionElementComponentAddDirect ( DimName, ConsolidatedElName , ElName , ElWeight);


  • DimName is the dimension you want to work with.
  • ConsolidatedElName is the element to which you want to add a child.
  • ElName is the name of the child element.
  • ElWeight is the weight of the child element. This is usually either 1 to add positive values, or -1 to subtract values from the parent. If you would like to read a full explanation of how to use weights, please see this post.

Usage and Example

DimensionElementComponentAddDirect is often used in combination with the DimensionElementInsertDirect statement to add a new element to a dimension and immediately include it in a relevant consolidation. Therefore, after you have added a new element (before the step of the TI is complete), you are then able to add it into a hierarchy.

DimensionElementComponentAddDirect ('GL Account', vParent_Account, vSub_Account, 1);

This will add the current contents of the variable vSub_Account to vParent_Account in the GL Account dimension with a weight of 1. In other words, positive values will add to the parent.

Often this function is used in conjunction with DIMIX to test if an element exists. Then, if it doesn’t using DimensionElementInsertDirect to insert it immediately. Then finally using DimensionElementComponentAddDirect to add it into a hierarchy. The code to do this would look like this:

## Add all elements from source
sAccountID = vAccountID ;

IF(DIMIX(DimName, sAccountID )=0);
    DimensionElementInsertDirect(DimName, '', sAccountID ,'N');

## Add Account Types as elements for Trial Balance Rollup
sAccountType = vAccountType;
IF(DIMIX(DimName, sAccountType )=0);
    DimensionElementInsertDirect(DimName, '', sAccountType ,'C');

# Roll elements up
sParentID = ConsName;
IF ( sParentID @<> '');
	DimensionElementComponentAddDirect(DimName, sAccountType, sAccountID , 1);

It might also be used with a DIMIX to test if a potential parent exists before having the element in question being added to that parent.

Notes and Tip Regarding a Potential Error

  • This function is different from DimensionElementComponentAdd in that DimensionElementComponentAdd will wait until the step of the TI (Prolog, Metadata, Data or Prolog) is complete before making all changes in batch. The DimensionElementComponentAdd can be much faster because of this.
  • The opposite of this function is DimensionElementComponentDelete.
  • This function can only be used in Turbo Integrator processes.
  • It also can only be used on Prolog or Metadata tabs (not the Data tab, it won’t do anything there!).
  • If you are creating elements and rolling them up in the process, the parent elements need to be higher in the source than the child elements. If the child elements came first, say with an ID of “Child” and a ParentID of “Parent” and then the parent ID was added afterwards, ParentID would not exist in the dimension when you were trying to apply DimensionElementComponentAdd. This would give an error, saying that ParentID could not be found. Then if you ran it again, the error would magically disappear. Make sure your parents are added first!
  • This field is for validation purposes and should be left unchanged.

Post Sections

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In