Error while trying to build a Named Hierarchy in a TI process

Post Reply
tm123
Posts: 132
Joined: Thu Oct 23, 2014 10:15 pm
OLAP Product: tm1, cognos bi
Version: 10.2
Excel Version: 2010

Error while trying to build a Named Hierarchy in a TI process

Post by tm123 »

Hi,

I am facing an issue while I am trying to build a new hierarchy in a TI Process. I have a dimension which has multiple ALternate Hierarchies ( what we used to call Alternate Hierarchies), and I am trying to convert them into Named Hierarchies.

I am able to convert them all, without any issues, but when I try to create a Brand New Hierarchy, TM1 throws an error:
Insertion of leaf "xyz" into hierarchy "DimName:HierarchyName" failed because a consolidated element by that name already exists in the dimension.

The Element "xyz" needs to be a COnsolidated Element into my new Hierarchy, and I tried to Insert it as a Consolidation before trying to add components into it, but nothing seems to work.

This element "xyz" is not part Base ( Old) Hierarchy

Thanks
Wim Gielis
MVP
Posts: 3182
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: Error while trying to build a Named Hierarchy in a TI process

Post by Wim Gielis »

And what is your TI code ?
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
tm123
Posts: 132
Joined: Thu Oct 23, 2014 10:15 pm
OLAP Product: tm1, cognos bi
Version: 10.2
Excel Version: 2010

Re: Error while trying to build a Named Hierarchy in a TI process

Post by tm123 »

Thanks for the reply:


#== Code in Prolog Tab
HierName = 'By Product Category' ;

IF ( HierarchyExists ( dimName, HierName ) = 0 ) ;
HierarchyCreate ( dimName, HierName ) ;
ELSE ;
HierarchydeleteAllElements ( dimName, HierName ) ;
ENDIF ;
HierarchySortOrder ( dimName, HierName , 'ByInput' , 'Ascending' , 'ByHierarchy' , 'Ascending' ) ;

sHierarchyTopNode = 'All Products by Category';
HierarchyElementInsert ( dimName , HierName , '' , sHierarchyTopNode , 'C' ) ;


#== Code in Metadata Tab

HierarchyElementInsert ( dimName, HierName, '', vLeafElemName , 'N' ) ;
IF ( HierarchyElementExists ( dimName, HierName, vRollupName ) = 0 ) ;
HierarchyElementInsert ( dimName, HierName, '', vRollupName, 'C') ;
ENDIF ;

HierarchyElementComponentAdd ( dimName, HierName , sHierarchyTopNode, vRollupName, 1 ) ;
HierarchyElementComponentAdd ( dimName, HierName , vRollupName, vLeafElemName , 1 ) ;

Thanks
User avatar
Steve Rowe
Site Admin
Posts: 2439
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: Error while trying to build a Named Hierarchy in a TI process

Post by Steve Rowe »

If we assume your code is correct and the error message is correct then the element must already exist.

I seem to remember being caught out by subset names clashing with new elements at one time. A by product of UDCs.

Try and dimix the element, what does it return?

If the Dimix > than max elements in the dim then you have a subset name.
Technical Director
www.infocat.co.uk
tm123
Posts: 132
Joined: Thu Oct 23, 2014 10:15 pm
OLAP Product: tm1, cognos bi
Version: 10.2
Excel Version: 2010

Re: Error while trying to build a Named Hierarchy in a TI process

Post by tm123 »

Hi guys,

It looks like Paul Simon has experienced the same issue, and I found something online regarding this.

He also provided a workaround, but before coming across his thread, I deleted the Dimension and re-created it. When i recreated the dimension, on the same time I did what Paul suggested and my issue is resolved. I hope that Paul's code has resolved my problem, and not the deletion of dimension

Here is the link with his thread:

https://community.ibm.com/community/use ... 4eda43146b

thanks
Post Reply