CreateHierarchyByAttribute Issue

Post Reply
MarenC
Regular Participant
Posts: 452
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

CreateHierarchyByAttribute Issue

Post by MarenC »

Hi,

I am trying to use the CreateHierarchyByAttribute function in Planning Analytics and am receiving the following error:
Error: Prolog procedure line (22): DIMENSIONHIERARCHYCREATE: Cannot create hierarchy "Code Region": dimension "Code" already has element names/aliases containing metacharacters.
The code is:

Code: Select all

sCodeDim = 'Code';
sCodeAttr = 'Code Region';
sTotal = 'Total Regions';
sDefault = 'Region Undefined';

IF( HierarchyExists( sCodeDim, sCodeAttr) =1);
	HierarchyDestroy( sCodeDim, sCodeAttr);
ENDIF;

CreateHierarchyByAttribute( sCodeDim, sCodeAttr, sDefault, sTotal);
Has anyone encountered this issue? Given the error message I assumed that some characters are not allowed in hierarchies, which was a surprise to me, given they are ok in the main hierarchy. I should stress it appears it is the element names and not the alias causing the issue.

As a test I deleted most of the elements from the dimension bar a few and ran the process again, and it ran successfully.

I then decided to delete the new hierarchy I had created by running: HierarchyDestroy( sCodeDim, sCodeAttr);

Then when I went to update the Code dimension I got the following error:
Error: MetaData procedure line (0): Serious system error, Dimension not updated
It would appear that by destroying the hierarchy it had corrupted the dimension.

Has anyone encountered this issue?

Maren
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: CreateHierarchyByAttribute Issue

Post by lotsaram »

CreateHierarchyByAttribute is strictly demoware. It is completely un thought out, e.g. it can only be run once and fails if the target hierarchy already exists so.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Adam
Posts: 125
Joined: Wed Apr 03, 2019 12:10 am
OLAP Product: IBM PA
Version: 2.0.9.x
Excel Version: Microsoft 365 x64

Re: CreateHierarchyByAttribute Issue

Post by Adam »

Do you get the error still if you SaveDataAll; in the if statement after HierarchyDestroy?
I've started blogging about TM1, check it out: www.havaslabs.com

Take care,
Adam
Wim Gielis
MVP
Posts: 3241
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: CreateHierarchyByAttribute Issue

Post by Wim Gielis »

As Lotsa implies, please disregard from that function and do it the proper way.
HierarchyElementInsert
HierarchyElementComponentAdd
Destroy parent-child relations and so on
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
Post Reply