DimensionElementPrincipalName, Syntax and Use

Today I needed to lookup an element ID from an alias in a TI process.  I found the DimensionElementPrincipalName function that does exactly that! It will also check if what you are looking for is a primary element ID as well, and if so, return that.

Syntax of DimensionElementPrincipalName

The syntax is:

DimensionElementPrincipalName( DimName, ToFind );

Where:

  • DimName is the name of the dimension you are wanting to check, and
  • ToFind is the text you want to find the element ID from.

Example

An example of this is:

sAward = DimensionElementPrincipalName ( 'Payroll Award' , sAwardDesc );

In this code we are updating a string variable, sAward, by looking up the text in sAwardDesc from the ‘Payroll Award’ dimension.

Notes re DimensionElementPrincipalName

  • This only works for aliases or the primary ID of an element.
  • The syntax does not require you to identify an attribute to check. this is because aliases and element IDs are unique. TM1 checks all aliases and the elements of a dimension to find the primary ID.
  • If the contents of ToFind are not found in either an alias or a primary ID, then the contents of ToFind are returned. NULL is not returned.
  • If ToFind is found, either in an alias or as the primary element ID, then the primary ID is returned.

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.

Leave a Reply

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