ATTRN TM1 Function: How to Use and Syntax within TI and Rules
ATTRN stands for ATTRibute Number, in other words it returns the contents of a string attribute from an element in a dimension in TM1.
Note this is not AttrGetN! That function does not exist!
Syntax of ATTRN
The syntax is:
ATTRN (dimension, element, attribute);
- dimension is the dimension you want to interrogate
- element is the element you want to find the attribute for
- attribute is the name of the attribute you want to get the result of
Assume that the variable sPeriod contains “Jan” and we have a Period dimension with a numeric attribute called Period No.
An example of the use is ATTRN (‘Period’, sPeriod, ‘Period No’); which will return the string value for the period number (in our case a numeric 1) for the month “Jan” from the dimension “Period”. Pretty easy huh!
Why would you use it? One of the reasons it is often used for is to pull from an attribute with the value representing the number of months to go back to get the prior period (1 for all months except Jan, which would use 11) and also the relative year to refer to for that period (which would be 0 for all except Jan, which would be 1). Then use those values to derive an offset rule to get the closing balance of the prior period.
This function can be used in both Rules and TI processes.
To retrieve the value of a string attribute, please use ATTRS.