COGNOiSe.com - The IBM Cognos Community

Planning & Consolidation => TM1 => Topic started by: donap on 09 Nov 2017 03:04:46 PM

Title: TM1 TI process- Set Security based on CHILD ?
Post by: donap on 09 Nov 2017 03:04:46 PM
Last question of the week -- I want to execute some looping similar to the following PSUEDO -CODE:
If this possible: (sort of Backwards Cascade of Security)

vGroupsDim = '}Groups';
vDimCountGrp = DIMSIZ(vGroupsDim);
vIndexGrp = 1;
WHILE (vIndexGrp <= vDimCountGrp);
    vTestGroup = DIMNM(vGroupsDim, vIndexGrp );

    vDim='Geography';
    vDimCount = DIMSIZ(vDim);
    vIndex = 1;

   WHILE (vIndex <= vDimCount);
      vTestElement = DIMNM( vDim, vIndex );
      if ((vTestGroup @= 'ABC') >> and Element is a PARENT
              and this group has any access NOT NONE to ONE or More Child Elements <<
);
          ElementSecurityPut('READ',vDim,vTestElement,vTestGroup);
             ...
      ...
... 

2> The other part of this not shown above - is I really want the " if ((vTestGroup @= 'ABC') "  to test on a Value of an ATTRIBUTE of the }Groups dimension.

Any help on how to do item 2 even if Item 1 is not possible is greatly apprectiated.
THanks

           


Title: Re: TM1 TI process- Set Security based on CHILD ?
Post by: AJAYC on 12 Nov 2017 10:27:49 AM
Donap

Part 1
------
So to finds out if an element is a parent or not, use the DTYPE () function, as shown below. The "&" is the TM1 "AND" equivalent. Not sure what you were asking for in the second red line

IF (
     (vTestGroup @= 'ABC ) &
     ( DYTPE ( vDim, vTestElement ) @= 'C' ) &
     not sure what you're asking for in the next line..........


Part 2
------
Replace the 'ABC' with an AttrGetS() function, so


sGroupAttribute = AttrGetS( '}Groups', vTestGroup, 'YourAttrribute' ) ;

IF (
     ( vTestGroup = sGroupAttribute ) etc


HTH
Ajay


Title: Re: TM1 TI process- Set Security based on CHILD ?
Post by: donap on 13 Nov 2017 08:11:21 AM
Thank you again AJAYC !
What I am trying to get for the line highlighted in RED in the original post is related to the Entire Loop of logic -- 
This is the non-code explanation of what I am trying to accomplish:  I need to dynamically determine if the Current }Group needs Element security to the current Parent level -- based on whether the that group already has Element Security to ANY ONE OR MORE of the Child Elements. 
For instance - - a group may have Element Security READ to New York City, Hartford, and Boston.
We have created an Alternate hierarchy called "NorthEast Large" 
I want to run a process that will loop through all my GROUPS, If a GROUP has READ access to ONE OR MORE of these children, than I want to set the Element security to READ for the parent "NorthEast Large".

For EVERY Group (the Current Group I am looking at is:   vTestGroup @= 'ABC')  I want to loop through the entire
GEOGRAPHY  dimension
If the Element I am looking at is a PARENT level element (Country, State, or top level of Alternate Hierarchy -  ( DYTPE ( vDim, vTestElement ) @= 'C' ) ),  then  I want to loop through ALL of the  CHILDREN elements of THIS parent.
If the Current GROUP I am has any access  Other than *NONE* to any ONE or more of the CHildren, then I need to assign Element Security of READ to this parent. 
SO the part in RED is the question -- How to do identify all corresponding Child elements in order to Loop through them  ?
Thank you
Title: Re: TM1 TI process- Set Security based on CHILD ?
Post by: AJAYC on 14 Nov 2017 03:16:03 AM
OK, so using the "ELCOMPN(YourDimension, YourElement)" function, you will be able to establish how many children sit within each parent.

This gives you a maximum loop counter for the loop when testing if any of the child elements have security or not.

You'll want to grab all the parents in a subset, and then for each one do the above, setting the security as soon as you find the first child that has the security you are wanting.

HTH
Ajay
Title: Re: TM1 TI process- Set Security based on CHILD ?
Post by: donap on 14 Nov 2017 08:50:02 AM
Thank you AJAYC for all your help and responses.   

I have enough info now to keep me busy for awhile.
AS I mentioned before - I have over 15 years with Cognos BI and ETL tools - only 3 months with TM1 and the contractor who was the expert and training me left last month !

I appreciate the help. 
When I try to Google TM1 things, it doesn't always find useful links -- or links me back to IBM documentation which I have, but isn't always the most complete, or have examples.

Thank you,