Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
PabloMC
Contributor II
Contributor II

Replicate Hierarchy node to last level

Hi, 

 

I need to know if i have a table like this:

NodeIdNodeNameParentId
0Root 
1A0
2AA1
3AB2
4B0
5BA4
6BB5
7BBA6
8C0
9CA8

 

How can i get this result? I'm looking for an easy way. Now i'm doing a walkaround looking for nulls and taking the previus node.  

NodeName NodeName1 NodeName2 NodeName3 NodeName4 
0Root0Root0Root0Root0Root
A0RootAAA
AA0RootAAAAA
AB0RootAABAB
B0RootBBB
BA0RootBBABA
BB0RootBBBBB
BBA0RootBBBBBA
C0RootCCC
CA0RootCCACA

 

 

I'm using Hierarchy prefix but it doesn't replicate the values to the last level. 

 

Thanks in advance. 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

I think your have a good approach.

I world do as normal hierarchy followed by an resident load of the hierarchy table. The alt() function should be a good approach for fetching the right field value.

Load
NodeName ,
NodeName1,
Alt(NodeName1,NodeName2) as NodeName2,
Alt(NodeName1,NodeName2, NodeName3) as NodeName3,
Alt(NodeName1,NodeName2, NodeName3, NodeName4) as NodeName4
Resident
HierarchyTable;

View solution in original post

1 Reply
Vegar
MVP
MVP

I think your have a good approach.

I world do as normal hierarchy followed by an resident load of the hierarchy table. The alt() function should be a good approach for fetching the right field value.

Load
NodeName ,
NodeName1,
Alt(NodeName1,NodeName2) as NodeName2,
Alt(NodeName1,NodeName2, NodeName3) as NodeName3,
Alt(NodeName1,NodeName2, NodeName3, NodeName4) as NodeName4
Resident
HierarchyTable;