Page 1 of 1

Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 7:41 pm
by PavoGa
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?

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 7:47 pm
by PavoGa
Nevermind. Seems that AttrInsert works:

ATTR('dimname:hierarchyname', '', 'newattribute, 'A');

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 7:48 pm
by ndivine
Attributes are not specific to hierarchies, but exist for the dimension and all hierarchies associated with that dimension.

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 8:07 pm
by PavoGa
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.

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 8:51 pm
by ndivine
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).

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 8:59 pm
by ndivine
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.

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 9:38 pm
by PavoGa
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.

Re: Hierarchy Attribute Functions

Posted: Mon Sep 10, 2018 9:56 pm
by PavoGa
Okay, got what I wanted by using "Caption" as the alias attribute. Wish this was a little more flexible, but can make this work.

Re: Hierarchy Attribute Functions

Posted: Tue Sep 11, 2018 7:28 am
by lotsaram
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".)

Re: Hierarchy Attribute Functions

Posted: Tue Sep 11, 2018 7:36 am
by lotsaram
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.

Re: Hierarchy Attribute Functions

Posted: Tue Sep 11, 2018 12:03 pm
by PavoGa
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.

Re: Hierarchy Attribute Functions

Posted: Tue Sep 11, 2018 2:44 pm
by ndivine
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.