Hierarchies Failing in PAW 2.077.1 On Premise

Post Reply
CalTech
Posts: 7
Joined: Wed Jul 08, 2020 5:45 am
OLAP Product: TM1
Version: 10.1
Excel Version: Excel Office 16

Hierarchies Failing in PAW 2.077.1 On Premise

Post by CalTech »

Hello All -

Context - I am doing a deep dive into Hierarchies. I'm using a test date range in a dimension (9/1/2024 - 9/14/2024) to create two alternative hierarchies. The Parent dimension are the dates in sequential order with a total of all dates at the top. The alternative hierarchies ("Alt Hier") are a Week and ITD hierarchy. I created the basic dimension for the two Alt Hier to test the build code. It worked perfectly. Next I converted the Week dimension TI process to create an alternative hierarchy.

Problem - The empty Hierarchy is created; however, the "week" consolidation elements are not created nor are the attributes added to the dimension.

Research - I searched to confirm that the versions that I am using in fact support Alt Hierarchies. From the posts that I could where version and hierarchies were mentioned, it seems that this is NOT a version issue. However, I may be wrong.

I am using a on Premise PAW 2.0.77.1 and TM1-AW64-ML-RTM-11.0.0.28-0.

I have attached word Below a word document with the code and images of the Output.
Hierarchies Side-by-Side.docx
(229.85 KiB) Downloaded 298 times
Thank you in advance for any guidance.




TI Process 1
DimName = '_zzMasterTime';
HierName = 'Week';
cAttr1 = 'DayNumber';
cAttr2 = 'Week';

IF(DimensionExists(DimName)=1);
DimensionDestroy(DimName);
DimensionCreate(DimName);
ELSE;
DimensionCreate(DimName);
ENDIF;

sHier = HIERARCHYCREATE(DimName,HierName);

AttrInsert(DimName, '', cAttr1, 'N');
AttrInsert(DimName, '', cAttr2, 'S');
cDayStart = '2024-09-01';
cDayEnd = '2024-09-14';
nEle = DAYNO(cDayStart);

WHILE(1 = 1);
sEle = TIMST(nEle, '\Y-\m-\d');
HIERARCHYELEMENTINSERT(DimName,HierName, '', sEle, 'N');
IF(sEle @= cDayEnd);
BREAK;
ELSE;
nEle = nEle + 1;
ENDIF;
END;

##################################################################

TI Process 2
DimName = '_zzMasterTime';
HierName = 'Week';
ElCnt = DimSiz(DimName);
nAttr1 = 'DayNumber';
sAttr1 = 'Week';
sElm = 1;
While(sElm <= ElCnt);
ElNm = ELEMENTNAME(DimName,HierName,sElm);
WkDt = TIMST(DAYNO(ElNm),'\Y-\m-\d');
DayNum = DAYNO(WkDt);
nOut = MOD(DayNum,7);
IF(nOut = 2);
Con = WkDt | '-Wk';
HierarchyElementInsert(DimName,HierName,'',Con,'S');
ENDIF;
sDim = EXPAND('%DimName%:%HierName%');
ATTRPUTN(DayNum,sDim,ElNm,nAttr1);
ATTRPUTS(Con,sDim,ElNm,sAttr1);
sElm = sElm +1 ;
END;
MarenC
Regular Participant
Posts: 436
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Hierarchies Failing in PAW 2.077.1 On Premise

Post by MarenC »

Hi,

Your screenshots confuse me as it appears the hierarchies have been created, I am also having trouble working out which is the expected and which is the actual outcome. Also, I don't see any reference to inserting a consolidated element in your code or anywhere that adds an element to a parent?

You mention the version being compatible with Hierarchies, while I don't think this is the issue I assume you set EnableNewHierarchyCreation to T in your config?

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

Re: Hierarchies Failing in PAW 2.077.1 On Premise

Post by lotsaram »

I think the problem is not in the computer but the organic interface between screen and keyboard ;)

You talk about a "Week" hierarchy and a "ITD" hierarchy, but both your TI process snippets are acting on Week, no action on ITD.

In Process 1:
leaf days are inserted in the hierarchy
but ...
- consolidated week elements not added
- leaf elements are also not added to the week consolidations
- no AttrPut to update Week or DayNumber attributes

In Process 2:
leaf days are inserted in the hierarchy
but ...
- consolidated week elements are added as type S not type C
- leaf elements not added to the week consolidations

So basically the code is producing exactly what you would expect it to. There is no failure in code execution, only in code content and code quality.

Note that you would need to delete the incorrectly created string type elements as string elements can't accept children.
You are using AttrPut and not ElementAttrPut function. This is OK since it looks like you only want to update attribute values for the leaf elements and for leaves the attribute values are SHARED across all hierarchies of the dimension. So if the element and attribute value already exists in the same named hierarchy (the dimension in v10 and earlier terms) then there shouldn't actually be any need to do this update anyway. However, if the element doesn't exist in the same named hierarchy then the AttrPut will fail due to the element not existing in the same named or "default" hierarchy even though it exists in the alternate hierarchy. Also note that if you are creating new elements then you can't do attribute update on those created elements until after the dimension or hierarchy has been compiled unless you are using InsertDirect functions to create the elements.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
CalTech
Posts: 7
Joined: Wed Jul 08, 2020 5:45 am
OLAP Product: TM1
Version: 10.1
Excel Version: Excel Office 16

Re: Hierarchies Failing in PAW 2.077.1 On Premise

Post by CalTech »

Hello Marenc -

First, thank you for you thoughts. I have added my clarifications below and attached a updated Code and Output table that addresses your thoughtful comments.
Update Hierarchies Side-by-Side.docx
(234.06 KiB) Downloaded 297 times
Your screenshots confuse me as it appears the hierarchies have been created:

RESPONSE -
My approach to create the Consolidation and the Hierarchy dimensions is to break the steps into separate TI processes. Process 1 creates the dimension, attributes and inserts the date elements. Process 2 creates the consolidation elements (See the right hand column "As Expected" screen shot for Process 2. It is Process 2 that is failing. The right hand column ("As Expected") screen shot includes the week of consolidations. The Left side does not.

For clarity, the left-side column title "Hierarchy Code" is the code that I am developing that will create the "Week" Alternative Hierarchy. The right column is the code that will create the dimension with the "Week" Consolidation. This code is provided as reference for what works for me.

I am also having trouble working out which is the expected and which is the actual outcome.

RESPONSE -
There are two TI Processes, which I have titled Process 1 and Process 2. Process 1 works for both Scenario H and Scenario C.
Scenario H / Process 2 is the TI process code that does not provide the expected result, which can be seen in Scenario C Process screen shot.

Also, I don't see any reference to inserting a consolidated element in your code or anywhere that adds an element to a parent?
RESPONSE -
Great question, these functions will be in the next process, which is not included here. I believe that If I can work out this issue, the next process will work fine. :lol:

You mention the version being compatible with Hierarchies, while I don't think this is the issue I assume you set EnableNewHierarchyCreation to T in your config?
RESPONSE -
Yes, it is in the config file. That was the first thing that I checked :)
CalTech
Posts: 7
Joined: Wed Jul 08, 2020 5:45 am
OLAP Product: TM1
Version: 10.1
Excel Version: Excel Office 16

Re: Hierarchies Failing in PAW 2.077.1 On Premise

Post by CalTech »

Hello lotsaram:

First, thank you for taking time to respond. This forum is very helpful.

Second, you are absolutely correct that there is failing organic mass (think 1960s "The Blob") that seeps across the keyboard creating this poor code. :lol: :lol:

I have added my responses below each of your comments for clarity. Let me summarize up here. Most of what you comment on occurs in the Process 3, which was not part this thread. The reasoning was that since Scenario H - Process 2 failed to mirror the output of Scenario C - Process 2 (see Update Hierarchies... file), I should not add additional complexity to the question. I assumed hopefully that the answer to this thread would fix any issue for the next Process.
Full TI Set.docx
(164.25 KiB) Downloaded 292 times
Once the thread is fully flushed out, I will add a post that summarizes all of the implemented suggestions for the community to source and read.

You talk about a "Week" hierarchy and a "ITD" hierarchy, but both your TI process snippets are acting on Week, no action on ITD.
Response -

I only included the Week hierarchy.

In Process 1: leaf days are inserted in the hierarchy, but ...
- consolidated week elements not added, - leaf elements are also not added to the week consolidations, - no AttrPut to update Week or DayNumber attributes
Response -

The Week elements and Attribute elements are added in Process 2.


In Process 2:leaf days are inserted in the hierarchy but ...
- consolidated week elements are added as type S not type C - leaf elements not added to the week consolidations
Response -

I have attached an updated version of the code and screen shots that will make it clear what is expected. I take your point on the type type and I will update it. However, in Scenario C, that was the type used and it produced the correct outcome. I did not include the full set of processes for this query. The third process actually adds the days to the the week consolidation. I have included the third code set for completeness, however, it is not part of this thread see file Full TI SET. This set is for creating a dimension with a default hierarchy and week of consolidations.

Note that you would need to delete the incorrectly created string type elements as string elements can't accept children.
You are using AttrPut and not ElementAttrPut function. This is OK since it looks like you only want to update attribute values for the leaf elements and for leaves the attribute values are SHARED across all hierarchies of the dimension. So if the element and attribute value already exists in the same named hierarchy (the dimension in v10 and earlier terms) then there shouldn't actually be any need to do this update anyway. However, if the element doesn't exist in the same named hierarchy then the AttrPut will fail due to the element not existing in the same named or "default" hierarchy even though it exists in the alternate hierarchy. Also note that if you are creating new elements then you can't do attribute update on those created elements until after the dimension or hierarchy has been compiled unless you are using InsertDirect functions to create the elements.
Response -

Thank you for this guidance. I am using version 11.
lotsaram
MVP
Posts: 3702
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Hierarchies Failing in PAW 2.077.1 On Premise

Post by lotsaram »

CalTech wrote: Thu May 22, 2025 5:53 pm Most of what you comment on occurs in the Process 3, which was not part this thread.
The request for assistance guidelines do say to include the full context of what you have done. Only providing half of what you have done isn't helpful, it just leaves people trying to help guessing.

I had a quick look at the second document you uploaded but it isn't really any clearer to me what or why you're doing. If you are trying to add the components to the week consolidations in process 3 then this will 100% fail as the week elements are added in process 2 with the wrong type and string elements cannot be consolidations so the xElementComponentAdd will fail.

I don't understand why you have 3 separate processes. Do it all on one. Conceptually easier, debugging easier, everything easier.

Due to the absence of defining consolidations it also kinda made me think perhaps you are coming from a DWH or columnar reporting tool background where attributes and consolidations are essentially the same thing since everything is just a GROUP BY. In case it wasn't clear already TM1 is not like this. You may use the same data from the same fact table to define both an attribute value of a leaf and the parent rollup path but in TM1 these are completely different concepts and one can exist without the other, there is on fact no overlap at all.

As you seem to have a sense of humour and I'm feeling charitable, I threw together a quick example of how I might approach some simple alternate hierarchies bases on a list of date elements. Just rename the .pro.txt file to just .pro and throw it together with the csv file into your data directory and restart the instance and then run the process and look at the "DateMaster" dimension and you will see alternate hierarchies for Year, Month, DayInMonth and ISOYearWeek. Read through the process. Hopefully this will give you more idea what you are doign wrong and what you should be doing than lengthy discussions here.
DateSet.csv
(57.85 KiB) Downloaded 301 times
Dim.DateMaster.Update.pro.txt
(6.46 KiB) Downloaded 290 times
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Post Reply