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: 
PriyankaT
Contributor
Contributor

Hierarchy & HierarchyBelongsTo

I want to use Hierarchy & HierarchyBelongsTo together in my solution. and in qlikview layout, on clicking the tree layout , I should be able to select and see all the hierarchy in the table box. How can I achieve that..I have written script like below-

TreeLayout:
QUALIFY *;
UNQUALIFY '*Key';
LOAD
ID AS mainKey,
code_name AS Name,
PARENTID AS ParentID,
DESCRIPTION AS Description,
SQL SELECT *
FROM dim_table;

UNQUALIFY *;

TreeLayoutView:
Hierarchy (mainKey, ParentID, Description, PrtName, Description, Path, '/', Depth)
LOAD
mainKey,
TreeLayout.ParentID AS ParentID,
TreeLayout.Description AS Description
RESIDENT TreeLayout;

TreeLayoutView2:
HierarchyBelongsTo (mainKey, ParentID, Description, [Ancestor ID], AncestorName, Depth)
LOAD
mainKey,
TreeLayout.ParentID AS ParentID,
TreeLayout.Description AS Description
RESIDENT TreeLayout;

View3:
LOAD [Ancestor ID] as mainKey,
mainKey as mainKey1
RESIDENT TreeLayoutView2;

//DROP Field Description FROM TreeLayoutView2;
DROP Table TreeLayoutView2;

 

0 Replies