Alternate Hierarchy

Post Reply
VReddy
Posts: 10
Joined: Wed Apr 19, 2017 5:15 pm
OLAP Product: 10.2.2
Version: 10.2.2
Excel Version: 2013

Alternate Hierarchy

Post by VReddy »

Hi All,

I have an issue with loading of alternate hierarchy in my dimension. There is no code written to load the alternate hierarchy in the metadata tab but it seems to be loading in the dimension.

Code: Select all

#****Begin: Generated Statements***
#****End: Generated Statements****


#===================================================================
# Ignore first row - Avoids Parent and Child being the same member
#===================================================================

if( vACCT @= sTopElement  % vACCT @='');
    itemSkip;
endif;

if( vCF_CODE1 @= '');
    itemSkip;
endif;


# ====================================================================================================
# Modify weighting to allow proper rollups
# ====================================================================================================

#Check for a non rollup operator
#x = SCAN('~' ,vCons);
#if (x <> 0);
#    weight=0;
#else;
#    x = SCAN('-' ,vCons);
#    if (x <> 0);
#        weight=-1;
#    else;
        weight=1;
#    endif;
#endif;

DimensionElementInsert(sdim,'','CASH FLOW ACCOUNTS','c');
DimensionElementInsert(sdim,'','Unmapped CASH FLOW ACCOUNTS','c');
DimensionElementComponentAdd(sDim, 'CASH FLOW ACCOUNTS', 'Unmapped CASH FLOW ACCOUNTS', weight);
# DimensionElementInsert(sdim,'','Invalid Account','c');
# DimensionElementComponentAdd(sDim, 'ACCOUNT', 'Invalid Account', weight);
#DimensionElementInsert(sdim,'','ACCOUNT_Alternate','c');

# ====================================================================================================
# Add elements to dimension
# ====================================================================================================

    if (DIMIX(sdim, vCF_CODE1) =0); 
         DimensionElementInsert(sdim,'',vCF_CODE1,'n');
              endif;

              if (vCF_CODE1 @<> 'CASH FLOW ACCOUNTS');
                    DimensionElementComponentAdd(sDim, 'CASH FLOW ACCOUNTS', vCF_CODE1, weight);
                 endif;


                  if (DIMIX(sdim, vCF_CODE2) =0);                   
                      DimensionElementInsert(sdim,'',vCF_CODE2,'n');
                       endif;


                            if (vCF_CODE2 @<> vCF_CODE1);
                             DimensionElementComponentAdd(sDim, vCF_CODE1, vCF_CODE2, weight);
                              endif;


                               if (DIMIX(sdim, vCF_CODE3) =0 );                                  
                                    DimensionElementInsert(sdim,'',vCF_CODE3,'n');
                                      endif;

                                     if (vCF_CODE3 @<> vCF_CODE2);
                                         DimensionElementComponentAdd(sDim, vCF_CODE2, vCF_CODE3, weight);
                                           endif;

                                            if (DIMIX(sdim, vCF_CODE4) =0);                                                 
                                                  DimensionElementInsert(sdim,'',vCF_CODE4,'n');
                                                  endif;

                                                      if (vCF_CODE4 @<> vCF_CODE3);
                                                           DimensionElementComponentAdd(sDim, vCF_CODE3, vCF_CODE4, weight);
                                                           endif;

 if (DIMIX(sdim, vACCT) =0);
     DimensionElementInsert(sdim,'',vACCT,'n');
  endif;

        if ((vACCT @<> vCF_CODE4) & (vCF_CODE4 @<> ''));
          DimensionElementComponentAdd(sDim, vCF_CODE4, vACCT, weight);
       else;
                   if ((vACCT @<> vCF_CODE3) & (vCF_CODE3 @<> ''));
              DimensionElementComponentAdd(sDim, vCF_CODE3, vACCT, weight);
             else;
                         if ((vACCT @<> vCF_CODE2) & (vCF_CODE2 @<> ''));
                              DimensionElementComponentAdd(sDim, vCF_CODE2, vACCT, weight);
                     else;
                                   if ((vACCT @<> vCF_CODE1) & (vCF_CODE1 @<> ''));
                                    DimensionElementComponentAdd(sDim, vCF_CODE1, vACCT, weight);
                            else;
                                     DimensionElementComponentAdd(sDim, 'CASH FLOW ACCOUNTS', vACCT, weight);
                                 endif;
                             endif;    
                         endif;
                     endif;



#For Process Logging
countRecords = countRecords + 1; 
User avatar
Steve Rowe
Site Admin
Posts: 2464
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Alternate Hierarchy

Post by Steve Rowe »

Hi VReddy,

More explanation is required.

Are you talking about
A. The new Hierarchies logic.
B. An alternate roll-up in a standard dimension?

If it B, there is no such thing as an alternate roll-up as a distinct object TM1 will just build the structure you tell it. If you are ending up with multiple disconnected consolidations in your dimension then the error is in the data you are processing or the code you are using to process it.

Cheers,
Technical Director
www.infocat.co.uk
VReddy
Posts: 10
Joined: Wed Apr 19, 2017 5:15 pm
OLAP Product: 10.2.2
Version: 10.2.2
Excel Version: 2013

Re: Alternate Hierarchy

Post by VReddy »

Steve Rowe wrote:Hi VReddy,

More explanation is required.

Are you talking about
A. The new Hierarchies logic.
B. An alternate roll-up in a standard dimension?

If it B, there is no such thing as an alternate roll-up as a distinct object TM1 will just build the structure you tell it. If you are ending up with multiple disconnected consolidations in your dimension then the error is in the data you are processing or the code you are using to process it.

Cheers,
Its 'B' --Alternate hierarchy is getting created in the dimension, there is no code mentioned in the metadata tab for creating the alternate hierarchy and even in the variable 'CF_ALT' is kept as ignore in the variable tab.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Alternate Hierarchy

Post by tomok »

As has been previously explained, there is no such thing as an "alternate hierarchy" in a standard dimension. Children roll to parents, depending on the code, in your data source. If you are expecting that all the leafs roll to parents, those roll to other parents, and so forth, such that everything rolls to one common parent and that is not happening then either 1) the source data is not as you are expecting it or 2) you don't know how to write a TI process correctly. If this is a process that has been working previously, now all of a sudden it doesn't then that would lead me to reason 1). You need to talk to whoever is responsible for the data source and find out what changed and why. Then you can come up with a plan of action for fixing either it or your TO code.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
VReddy
Posts: 10
Joined: Wed Apr 19, 2017 5:15 pm
OLAP Product: 10.2.2
Version: 10.2.2
Excel Version: 2013

Re: Alternate Hierarchy

Post by VReddy »

tomok wrote:As has been previously explained, there is no such thing as an "alternate hierarchy" in a standard dimension. Children roll to parents, depending on the code, in your data source. If you are expecting that all the leafs roll to parents, those roll to other parents, and so forth, such that everything rolls to one common parent and that is not happening then either 1) the source data is not as you are expecting it or 2) you don't know how to write a TI process correctly. If this is a process that has been working previously, now all of a sudden it doesn't then that would lead me to reason 1). You need to talk to whoever is responsible for the data source and find out what changed and why. Then you can come up with a plan of action for fixing either it or your TO code.
Is there anyway I can send the screenshot which I wish to .. so that it might gives you a clear picture of it. There is no fields in the data source from the Database end to get those alternate hierarchy to get created in the dimension and even in the code in TM1.

I am unable to insert the image or screenshot ,plz can any one guide me through this.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Alternate Hierarchy

Post by tomok »

So, you're trying to tell us that there are no fields in your data source that specify the parent-child relationships in your data AND furthermore you don't have any lines of code using the DIMENSIONELEMENTCOMPONENTADD function anywhere? How are you creating ANY hierarchy at all?
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
VReddy
Posts: 10
Joined: Wed Apr 19, 2017 5:15 pm
OLAP Product: 10.2.2
Version: 10.2.2
Excel Version: 2013

Re: Alternate Hierarchy

Post by VReddy »

I realize this is confusing but There is a code to build the standard hierarchy which is built off a DB table, that works without an issue.
This alternate hierarchy is being created seemingly out of nothing because although the Column itself did exist in the DB at one point it was being ignored in the Variable Tab in TM1 and there was no code written that referenced it at any point in the Metadata or any other tab. When we couldn't solve the issue in our first go around we subsequently removed it completely from the DB Table so that TM-1 never had it in the View or the variable tab, we Deleted all the elements in the Dimension even Ran a SAVE DATA ALL and rebuilt the dimension and the Alternate Hierarchy was still rebuilt. My Thought is there is some "ghost code" that remains in the background file but I can't bring myself to believe that. I am left with what think is my only option to delete the TI and the dimension along with the cube and rebuild everything.
Thoughts?
User avatar
Steve Rowe
Site Admin
Posts: 2464
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Alternate Hierarchy

Post by Steve Rowe »

Hi, it sound to me that you are not clearing down the hierarchy before you rebuild it? Like doing a viewzeroout before a dataload you need to clear the structure from the dimension before you rebuild it (assuming all the structure in the dimension is from the same source).

If you don't then you will end up with all the structure that every existed in your source and likely end up with double counting or old redundant bits of structure.

Sorry did not read your reply fully, if you have started from a blank dimension and you got the mystery structure then the records / column must be in your datasource. Have you done a ascii export to see what records are being processed.
Technical Director
www.infocat.co.uk
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Alternate Hierarchy

Post by Wim Gielis »

VReddy wrote:My Thought is there is some "ghost code" that remains in the background file but I can't bring myself to believe that.
A chore maybe ;-)

Steve's comments are what you should look at to get to the bottom of this.
Best regards,

Wim Gielis

IBM Champion 2024-2025
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
VReddy
Posts: 10
Joined: Wed Apr 19, 2017 5:15 pm
OLAP Product: 10.2.2
Version: 10.2.2
Excel Version: 2013

Re: Alternate Hierarchy

Post by VReddy »

Wim Gielis wrote:
VReddy wrote:My Thought is there is some "ghost code" that remains in the background file but I can't bring myself to believe that.
A chore maybe ;-)

Steve's comments are what you should look at to get to the bottom of this.
I finally came to solve this issue, it was the one in prolog tab about Cn_dimension cube in which file name having sql query is different from the one in the data source tab. so I deleted the sql query in the cn_dimension cube and ran the TI process which built the dimension without the alternate hierarchy i it.

thanks to everyone who tried to help me out.
Post Reply