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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
okbtle
Contributor II
Contributor II

More than one Selfjoin

Hi all,

One table from a database, which has the parent in the same table. But a entry can have more than one parent. It's nowhere defined how many parents, but what I see, should there be not more than 15. How can I get the full path for each entry? At the end I should get for each entry the whole path.

A example from the table

IDpart of pathParent ID
1root
2fruits1
3banana2
4apple2
5yellow3
6vegetables1
7potato6

I need at the end

IDfull path
1root
2root/fruits
3root/fruits/banana
4root/fruits/apple
5root/fruits/banana/yellow
6root/vegetables
7root/vegetables/potato

One self join is no problem, but this... I really need help.

thanks in advance,

Tina

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

try hierarchy keyword

Hierarchy(ID,ParentID,partofpath)

LOAD * INLINE [

    ID, partofpath, ParentID

    1, root

    2, fruits, 1

    3, banana, 2

    4, apple, 2

    5, yellow, 3

    6, vegetables, 1

    7, potato, 6

];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

try hierarchy keyword

Hierarchy(ID,ParentID,partofpath)

LOAD * INLINE [

    ID, partofpath, ParentID

    1, root

    2, fruits, 1

    3, banana, 2

    4, apple, 2

    5, yellow, 3

    6, vegetables, 1

    7, potato, 6

];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

Hierarchy ‒ QlikView

HierarchyBelongsTo ‒ QlikView

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
okbtle
Contributor II
Contributor II
Author

Thank you very much, it's exactly what I searched.