Page 1 of 1

Hierarchy Caption attribute

Posted: Wed Sep 12, 2018 8:14 pm
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.

Re: Hierarchy Caption attribute

Posted: Wed Sep 12, 2018 8:25 pm
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' ) ?

Re: Hierarchy Caption attribute

Posted: Thu Sep 13, 2018 1:51 pm
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.

Re: Hierarchy Caption attribute

Posted: Fri Sep 14, 2018 8:06 pm
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.

;)

Re: Hierarchy Caption attribute

Posted: Wed Oct 03, 2018 1:06 pm
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.

Re: Hierarchy Caption attribute

Posted: Wed Oct 03, 2018 1:09 pm
by PavoGa
This may need to moved to another thread as it deal with a different topic from the original. My bad on that.