Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
where the advantage of using the Hierarchy function in the script if we can create a table with several columns with hierarchy and dimensions with drill-down ?
It will be for a subject of performance?
"Hierarchy (NodeID, ParentNodeID, Title, 'Manager') LOAD NodeID, ParentNodeID, Title FROM 'lib://data/hierarchy.txt' (txt, codepage is 1252, embedded labels, delimiter is ',', msq);"
In most cases, you don't need Hierarchy function to build hierarchy. For example, Year-Month-Date.
But there could be reasons for using it. Imaging a table that has EmployeeID and ManagerID (for each Employee except the top manager), and the number of levels is not fixed. In this case the Hierarchy function can help.
i used this example :
NodeID | ParentID | NodeName |
1 | General Manager A | |
2 | General Manager B | |
11 | 1 | Region Manager A |
111 | 11 | Manager 1 |
112 | 11 | Manager 2 |
1111 | 111 | Consultant AA1 |
1112 | 111 | Consultant AA2 |
1121 | 112 | Consultant AA3 |
1122 | 112 | Consultant AA4 |
used in hierarchy.
It is not the same as having a table of this structure ?
Level1 | Level2 | Level3 | Level4 |
General Manager A | Region Manager A | Manager 1 | Consultant AA1 |
General Manager A | Region Manager A | Manager 1 | Consultant AA2 |
General Manager A | Region Manager A | Manager 2 | Consultant AA3 |
General Manager A | Region Manager A | Manager 2 | Consultant AA4 |
General Manager B |
See these blog posts:
Ricardo,
It is a good example. The first part you show is a data source, and the second part is a result. You can build this result from the data source with or without hierarchy function. What is better in every particular case, it depends or the specifics. For example, in you case, you can do this without hierarchy if the number of levels is always four or less.
In case of Parent-Child Hierarchy without fixed number of levels formation this will be helpful
Thanks gwassenaar , Michael for the info.