Hierarchy Attribute Functions

Post Reply
User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Hierarchy Attribute Functions

Post by PavoGa » Mon Sep 10, 2018 7:41 pm

The Reference Guide contains the functions HierarchyAttrPutS, HierarchyAttrPutN, HierarchyATTRS and HierarchyATTRN. There are separate functions for manipulating attributes for Hierarchy Subsets. However, there does not seem to be corresponding functions like HierarchyAttrInsert and HierarchyAttrDelete.

I've tried using the DimensionAttrInsert with the 'DimName':'HierName' form, but it will not even compile. I searched, but nothing comes up about how to create a hierarchy attribute that the functions listed above can interact with.

So...how does one go about creating a hierarchy attribute that the HierarchyATTR... functions can be used against?
Ty
Cleveland, TN

User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Re: Hierarchy Attribute Functions

Post by PavoGa » Mon Sep 10, 2018 7:47 pm

Nevermind. Seems that AttrInsert works:

ATTR('dimname:hierarchyname', '', 'newattribute, 'A');
Ty
Cleveland, TN

ndivine
Posts: 12
Joined: Wed Feb 23, 2011 6:43 pm
OLAP Product: TM1
Version: Latest
Excel Version: 2013

Re: Hierarchy Attribute Functions

Post by ndivine » Mon Sep 10, 2018 7:48 pm

Attributes are not specific to hierarchies, but exist for the dimension and all hierarchies associated with that dimension.

User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Re: Hierarchy Attribute Functions

Post by PavoGa » Mon Sep 10, 2018 8:07 pm

While the ATTR('dimname:hierarchyname', ...) syntax compiled and ran, it did not seem to accomplish anything.

Here is what I'm wanting to do: we will have hierarchies that vary by version. We want to identify or name the hierarchy with a key and then use an alias for display purposes. Seems that we should be able to do that.

Thanks, ndivine, for that. That seems to be what the documentation hinted at, but not quite able to get it to work.
Ty
Cleveland, TN

ndivine
Posts: 12
Joined: Wed Feb 23, 2011 6:43 pm
OLAP Product: TM1
Version: Latest
Excel Version: 2013

Re: Hierarchy Attribute Functions

Post by ndivine » Mon Sep 10, 2018 8:51 pm

AttrInsert adds an attribute to the dimension. Then, you would need to populate that attribute with a value for an element using AttrPutS or HierarchyAttrPutS. . Then, you could pull that attribute value using ATTRS or HierarchyATTRS.

But, it sounds like you are actually trying to set up an alias for the hierarchy name itself, which would involve creating attributes on a control dimension, like '}Hierarchies_DimName'. While possible, I don't know that it gets you much as that alias only exists on the }Hierarchies_DimName dimension which is not a dimension you will be using (generally).

ndivine
Posts: 12
Joined: Wed Feb 23, 2011 6:43 pm
OLAP Product: TM1
Version: Latest
Excel Version: 2013

Re: Hierarchy Attribute Functions

Post by ndivine » Mon Sep 10, 2018 8:59 pm

To further clarify, you would add attributes to a dimension so that you can store attribute information about the elements within that dimension. To store attribute information about hierarchy names, you don't add attributes to dimension:hierarchy, you have to add them to the dimension that has dimension:hierarchy elements within it, which is }Hierarchies_DimName.

User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Re: Hierarchy Attribute Functions

Post by PavoGa » Mon Sep 10, 2018 9:38 pm

ndivine wrote:
Mon Sep 10, 2018 8:59 pm
To further clarify, you would add attributes to a dimension so that you can store attribute information about the elements within that dimension. To store attribute information about hierarchy names, you don't add attributes to dimension:hierarchy, you have to add them to the dimension that has dimension:hierarchy elements within it, which is }Hierarchies_DimName.
Actually, there are a whole host of functions that seem to indicate that attributes can be added to Hierarchies and Hierarchy elements separate from the dimension attributes. I'm using PA2.0

I was able to add an alias, "AltName" to the Dimensions dimension

Code: Select all

DimensionAttrInsert('', 'AltName', 'A');
and subsequently populated it:

Code: Select all

HierarchyAttrPutS('The Crazy Hierarchy', 'Accounts Master', 'Statistical Categories', 'AltName');
The }DimensionsAttribute cube is populated as prettily as can be, but for the life of me cannot use the alias. Tried it on just the dimension name and it still will not use the alias for that dimension name. However, further research indicated the usage of "Caption" to localize an application. While cool, the reference manual does not make any mention this functionality is strictly limited to an alias called "Caption" and that is the only allowed usage. Guess I could make do, but the functions seem to be long on promise and just short on delivery with regards to aliases.
Ty
Cleveland, TN

User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Re: Hierarchy Attribute Functions

Post by PavoGa » Mon Sep 10, 2018 9:56 pm

Okay, got what I wanted by using "Caption" as the alias attribute. Wish this was a little more flexible, but can make this work.
Ty
Cleveland, TN

lotsaram
MVP
Posts: 3107
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TM1, CX
Version: TM1 10.2.2 PA 2.0x
Excel Version: 2010 2013 365
Location: Switzerland

Re: Hierarchy Attribute Functions

Post by lotsaram » Tue Sep 11, 2018 7:28 am

PavoGa wrote:
Mon Sep 10, 2018 9:56 pm
Okay, got what I wanted by using "Caption" as the alias attribute. Wish this was a little more flexible, but can make this work.
The Caption attribute doesn't have to be an alias, it can also be a text attribute. (But is does have to be called "Caption".)
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

lotsaram
MVP
Posts: 3107
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TM1, CX
Version: TM1 10.2.2 PA 2.0x
Excel Version: 2010 2013 365
Location: Switzerland

Re: Hierarchy Attribute Functions

Post by lotsaram » Tue Sep 11, 2018 7:36 am

ndivine wrote:
Mon Sep 10, 2018 8:59 pm
To further clarify, you would add attributes to a dimension so that you can store attribute information about the elements within that dimension. To store attribute information about hierarchy names, you don't add attributes to dimension:hierarchy, you have to add them to the dimension that has dimension:hierarchy elements within it, which is }Hierarchies_DimName.
Don't do this ! It would be fairly non-productive :D
The dimensions }subsets_dimName, }hierarchies_dimName & }views_cubeName are all destroyed during server shutdown phase and don't exist in the at rest copy of the instance. These dimensions get rebuilt from scratch during server startup from analysis of the data directory contents just like the }dimensions and }cubes dimensions. So any attributes added here will exist only for the current session.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

User avatar
PavoGa
Community Contributor
Posts: 227
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0
Excel Version: 2013
Location: Cleveland, Tennessee

Re: Hierarchy Attribute Functions

Post by PavoGa » Tue Sep 11, 2018 12:03 pm

lotsaram wrote:
Tue Sep 11, 2018 7:28 am
PavoGa wrote:
Mon Sep 10, 2018 9:56 pm
Okay, got what I wanted by using "Caption" as the alias attribute. Wish this was a little more flexible, but can make this work.
The Caption attribute doesn't have to be an alias, it can also be a text attribute. (But is does have to be called "Caption".)
Chose to go with alias as the alias can be passed as an argument, while a text attribute cannot. Although, I did find some of the online documentation for IBM actually contradicted itself on this point.
Ty
Cleveland, TN

ndivine
Posts: 12
Joined: Wed Feb 23, 2011 6:43 pm
OLAP Product: TM1
Version: Latest
Excel Version: 2013

Re: Hierarchy Attribute Functions

Post by ndivine » Tue Sep 11, 2018 2:44 pm

lotsaram wrote:
Tue Sep 11, 2018 7:36 am
ndivine wrote:
Mon Sep 10, 2018 8:59 pm
To further clarify, you would add attributes to a dimension so that you can store attribute information about the elements within that dimension. To store attribute information about hierarchy names, you don't add attributes to dimension:hierarchy, you have to add them to the dimension that has dimension:hierarchy elements within it, which is }Hierarchies_DimName.
Don't do this ! It would be fairly non-productive :D
The dimensions }subsets_dimName, }hierarchies_dimName & }views_cubeName are all destroyed during server shutdown phase and don't exist in the at rest copy of the instance. These dimensions get rebuilt from scratch during server startup from analysis of the data directory contents just like the }dimensions and }cubes dimensions. So any attributes added here will exist only for the current session.
Good to know.

To clarify on the }Dimensions dimension, attributes here will persist session to session. I have several models that use attributes here. And to add to the confusion, there are two ways to do dimension attributes: 1. }DimensionAttributes, accessed by right-clicking on Dimensions>Edit Attributes (in Server Explorer) and 2. }ElementAttributes_}Dimensions which is created by Editing Element Attributes on the }Dimensions dimension.

Post Reply