Hierarchy Caption attribute

Post Reply
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Hierarchy Caption attribute

Post by PavoGa »

I know I'm wearing this out, but keep running into speed bumps with this stuff.

Added a caption attribute as an alias for dimensions (DimensionAttrInsert) which works beautifully in that I have hierarchies named AF1, AF2, ... and set the aliases so that AF1 displays as "Accounts Forecast", AF2 as "Accounts Forecast 201901", ... in PAW.

However, when passing a parameter for the Hierarchy name to a TI process, I want to verify the hierarchy exists. As the underlying name is not displaying in PAW I want to provide the caption, "Accounts Forecast" so that:

Code: Select all

# psHierarchy is a parameter for the TI: psHierarchy = 'Accounts Forecast';
# Accounts Master is the dimension.  AF1 is a hierarchy in that dimension.
dimName = 'Accounts Master';

# This returns nHierarchy = 0.
nHierarchyExists = HierarchyExists(dimName, psHierarchy);
Have also tried a number of ways to get the actual hierarchy name using the caption, but have been unsuccessful. Is what I'm trying to do feasible? My reading of some of the documentation indicates that as long as Caption is an alias what I'm trying to do should work.
Ty
Cleveland, TN
Wim Gielis
MVP
Posts: 3103
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Hierarchy Caption attribute

Post by Wim Gielis »

Not sure if this is:
1. possible
2. efficient or overkill,

but you could check whether the dimension }Hierarchies_dim exists in step 1.
If yes, you could do a Dimix > 0 on the hierarchy name within that dimension.
Do you see both names in that dimension ('Accounts Forecast' and 'AF1' ) ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: Hierarchy Caption attribute

Post by PavoGa »

Wim Gielis wrote: Wed Sep 12, 2018 8:25 pm Not sure if this is:
1. possible
2. efficient or overkill,

but you could check whether the dimension }Hierarchies_dim exists in step 1.
If yes, you could do a Dimix > 0 on the hierarchy name within that dimension.
Do you see both names in that dimension ('Accounts Forecast' and 'AF1' ) ?
Thank, Wim. No, it seems in }Dimensions and }Hierarchies_Accounts Master, the elements are Accounts Master:AF1, the base hierarchy name.

Guess I could try and add an }ElementAttributes_}Dimensions cube and keep TWO sets of alias. That may work. I'm in a class today, I'll try that sometime later.

Frustrating. We have a need for managing a number of hierarchies which may vary by version within a cube. I think I can still accomplish what I really want to do, but the ability to use an alias on the hierarchy object itself would be nice for more than just changing the display name.
Ty
Cleveland, TN
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: Hierarchy Caption attribute

Post by PavoGa »

Looks like the only way to do what I want is adding an alias attribute to }Dimensions through the regular ATTRINSERT function. PAW does not seem to use the caption from }ElementAttributes_}Dimensions, so have to maintain the alias in two places. }ElementAttributes_}Dimensions for getting the primary hierarchy name and }DimensionAttributes to use the caption in PAW.

;)
Ty
Cleveland, TN
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: Hierarchy Caption attribute

Post by PavoGa »

Have found what I would consider to be a bug in the HierarchyExists function. This:

Code: Select all

     # none of these objects exist.
    cubTest = 'SEC';
    dimTest = 'Eastern Division';
    sElement = 'Georgia';
    subTest = sTmp;
    
    nCubeExists = CubeExists(cubTest);
    nCubeExists2 = CubeExists('');
    nDimExists = DimensionExists(dimTest);
    nDimExists2 = DimensionExists('');
    nElementExists = DIMIX(dimAccountsMaster, sElement);
    nElementExists2 = DIMIX(dimAccountsMaster, '');
    nSubsetExists = SubsetExists(dimAccountsMaster, subTest);
    nSubsetExists2 = SubsetExists(dimAccountsMaster, '');
    nHierExists = HierarchyExists(dimAccountsMaster, 'Alabama');
    nHierExists2 = HierarchyExists(dimAccountsMaster, '');
    
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Cube Exists.......: %nCubeExists%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Cube Exists2......: %nCubeExists2%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Dim Exists........: %nDimExists%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Dim Exists2.......: %nDimExists2%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Element Exists....: %nElementExists%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Element Exists2...: %nElementExists2%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Subset Exists.....: %nSubsetExists%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Subset Exists2....: %nSubsetExists2%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Hier Exists.......: %nHierExists%'));
    ASCIIOUTPUT(sPrologErrLogFile, EXPAND('Hier Exists2......: %nHierExists2%'));
    
Returns:
"Cube Exists.......: 0.000"
"Cube Exists2......: 0.000"
"Dim Exists........: 0.000"
"Dim Exists2.......: 0.000"
"Element Exists....: 0.000"
"Element Exists2...: 0.000"
"Subset Exists.....: 0.000"
"Subset Exists2....: 0.000"
"Hier Exists.......: 0.000"
"Hier Exists2......: 1.000"
That is not consistent with previous ...Exists functions.
Ty
Cleveland, TN
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: Hierarchy Caption attribute

Post by PavoGa »

This may need to moved to another thread as it deal with a different topic from the original. My bad on that.
Ty
Cleveland, TN
Post Reply