Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
zebhashmi
Specialist
Specialist

I have a table with two fields Name and Father Name

like

Id          -- Name --       Father ID

100            A                       --

101            B                      100

102             C                     100

103             D                     102

104            E                       102

if I will select E I want a list of all fathers.

like

A

C

E

is it possible?

Regards

JH

1 Solution

Accepted Solutions
MarcoWedel

Hi,

maybe one solution might be:

QlikCommunity_Thread_286989_Pic1.JPG

QlikCommunity_Thread_286989_Pic2.JPG

QlikCommunity_Thread_286989_Pic3.JPG

QlikCommunity_Thread_286989_Pic4.JPG

QlikCommunity_Thread_286989_Pic5.JPG

tabNodes:

Hierarchy (Id,ParentID,Name,'ParentName',Name,'Path',,'Depth')

LOAD * INLINE [

    Id, Name, ParentID

    100, A, --

    101, B, 100

    102, C, 100

    103, D, 102

    104, E, 102

];

tabAncestors:

HierarchyBelongsTo (Id,ParentID,Name,'AncestorID','AncestorName','DepthDiff ')

LOAD Id, Name, ParentID Resident tabNodes;

DROP Field Name From tabAncestors;

hope this helps

regards

Marco

View solution in original post

4 Replies
MarcoWedel

Hi,

maybe one solution might be:

QlikCommunity_Thread_286989_Pic1.JPG

QlikCommunity_Thread_286989_Pic2.JPG

QlikCommunity_Thread_286989_Pic3.JPG

QlikCommunity_Thread_286989_Pic4.JPG

QlikCommunity_Thread_286989_Pic5.JPG

tabNodes:

Hierarchy (Id,ParentID,Name,'ParentName',Name,'Path',,'Depth')

LOAD * INLINE [

    Id, Name, ParentID

    100, A, --

    101, B, 100

    102, C, 100

    103, D, 102

    104, E, 102

];

tabAncestors:

HierarchyBelongsTo (Id,ParentID,Name,'AncestorID','AncestorName','DepthDiff ')

LOAD Id, Name, ParentID Resident tabNodes;

DROP Field Name From tabAncestors;

hope this helps

regards

Marco

vvvvvvizard
Partner - Specialist
Partner - Specialist

Try using generic key

Generic keys

zebhashmi
Specialist
Specialist
Author

Thank you very Much, looks good let me try.

my table has list of 1000's I would be picking different values. let me see if it solves the purpose.

but very helpful thank you very much

zebhashmi
Specialist
Specialist
Author

One more Question is there a way that I can just add field Path in my table to keep it simple?