Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
amien
Specialist
Specialist

simple Hierarchy question

i have a table that with this layout:

id, idname, groupid, groupname, masterid, mastername

how can i use this with the Hierarchy function? i'v checked the manual, but i cant get this working.

can someone please paste a load script for me?

masterid contains the ultimate parent. but i want to do this based on the groupname and than up:

so output should be something like in a pivot:

idname, groupname, groupname, groupname (=mastername)

idname, groupname (=mastername)

etcetc

this is what i have so far... i dont get NameNode1...10


Hierarchy (NodeID, ParentID, NodeName, ParentName, ShortNodeName, PathName, ' - / - ', Depth)
LOAD NodeID,
ParentID,
NodeName,
Left(NodeName,3) as ShortNodeName,
NodeID as Attribute1;
SQL SELECT *
FROM TABLE;

Ancestors:
HierarchyBelongsto (NodeID, ParentID, Node, TreeID, Tree, DepthDiff)
LOAD NodeID,
ParentID,
NodeName as Node,
NodeID as Attribute2
Resident ExpandedAdjacentNodes;


5 Replies
amien
Specialist
Specialist
Author

This works


[Adjacent Nodes]:
LOAD NodeID, NodeName, NodeLocation, ParentID, ParentName, ParentLocation;
SQL SELECT *
FROM TABLE;

[Hierarchy]:
HIERARCHY (NodeID,ParentID,L,ParentName,NodeID,Path)
LOAD
NodeID
,ParentID
,NodeName as L
,NodeID as PathSource
RESIDENT [Adjacent Nodes]
;

HierarchyBelongsTo (NodeID,ParentID,NodeName,CategoryTreeID, CategoryTree,DepthDiff)
LOAD NodeID,
NodeName,
ParentID
Resident [Adjacent Nodes];


Not applicable

Does anyone know if this syntax is specific to v9? I am trying in 8.5 and getting an error that the "file is not found"?





CostCenter:

Hierarchy

LOAD

,

Parent_Cost_Center_Cd;

SQL

FROM

CFDW2_HYPER_TBLS.Hyper_Cost_Center_Hir_Hist; SELECT Cost_Center_Cd,

Cost_Center_Desc,

Parent_Cost_Center_Cd

Cost_Center_Cd,

Cost_Center_Desc

(Cost_Center_Cd, Parent_Cost_Center_Cd, Cost_Center_Desc)



Not applicable

Hi All,

Try to structure the script like this. Let me know whether it works as per your need.

new:
Load Field-1,
Field-1 &'|'& Field-2 &'|'& Field-3 as Hierarchy,
Field-2,
Field-3
RESIDENT tablename;
[

Not applicable

Hi Amien!

I am waiting for your reply. Let me know does it works as per your expectation?

Regards,

Rikab

amien
Specialist
Specialist
Author

dsjain,

i think you are waiting for stewart.teed to reply. i posted the answer to my problem in the second post.