Page 1 of 1

CreateHierarchyByAttribute Issue

Posted: Thu Sep 18, 2025 2:20 pm
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

Re: CreateHierarchyByAttribute Issue

Posted: Fri Sep 19, 2025 8:20 am
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.

Re: CreateHierarchyByAttribute Issue

Posted: Fri Sep 19, 2025 5:10 pm
by Adam
Do you get the error still if you SaveDataAll; in the if statement after HierarchyDestroy?

Re: CreateHierarchyByAttribute Issue

Posted: Sat Sep 20, 2025 10:55 am
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