How to Find the Level of an Element in TM1: ELLEV Use and Syntax
The ELLEV function returns the numeric value of the level for an element in a dimension in TM1.
The syntax is:
- dimension, is the dimension you are interrogating, and
- element, is the element you want the level number for
Use of ELLEV in a Rule
In this example, ELLEV is used to determine the level of an element so we can assign a rule specifically to that level. In this instance it was setting security access to weeks on a Time dimension, so that if the week being assessed was less than the Current Week definition from System Control, then the Week should be set as Read Only, otherwise it can be Write. We then use a Continue to move onto the next rule if this rule does not apply.
 = S: IF ( ELLEV ( 'Time', !Time) = 0 ,IF ( ATTRN ('Time', !Time, 'FY Week No') <= DB('System Control','Current Week','Value'), 'READ','WRITE') ,CONTINUE );
Use of ELLEV in a TI Process
This function is used to determine the level of a specific element in a dimension. It is often used in conjunction with an IF statement to then do something based on the result.
For example, if I want to test to see if an element is an N level element you would nest an ELLEV into an IF statement like the following. Then based on the outcome of the IF statement, I could populate a variable (in this case called sParent) for subsequent use in creating or updating a hierarchy in a Turbo Integrator process.
IF ( ELLEV ('Products', vProduct) =0); sParent = ATTRS ('Products', vProduct, 'BossProduct'); blah blah ELSE; ITEMSKIP; ENDIF;
This function is valid in both Rules and Turbo Integrator processes.