Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shani1
Contributor II
Contributor II

Create a new table with part relations (hierarcy)

Hi,

I am stuck with it and can't come up with any solution. 

i have a table with two fields "product part" and "sub parts" it has arround 7 Million rows. i tried hierarcy and hierarcybelongsto both takes some hours and from 7 Million rows it creates 400+ Million rows and then server memmory runs out. i tried it on Qliksense desktop and after 7 hourse of loading still no success. 

here is the senario

PARTSUB_PART
AF
B 
C 
D 
E 
FB
G 

 

if we call Part column as "parent" and sub_part column as "child"

child B has the parent F, and F has the parent A. 

what i am trying to do is to build a table like  "Parent > Child > child > child"

find the lowest part and go up to the highest part  number.

any suggestion or solution?

Labels (5)
4 Replies
morgankejerhag
Partner - Creator III
Partner - Creator III

Hierarcybelongsto should work for that. Do you maybe have duplicate rows in the data? Or loops in the hierarchy (B belongs to F that belongs to A that belongs to B)?

If you know the depth of the tree you can manually join the table as well.

Saravanan_Desingh

Try this. But I am not sure about the performance as you have millions of records.

tab1:
Hierarchy(SUB_PART, PART, Node,ParentName, Node,PathName, '/', Depth) 
LOAD *, PART As Node;
LOAD * INLINE [
    PART, SUB_PART
    A, F
    B,  
    C,  
    D,  
    E,  
    F, B
    G,  
];

 

Saravanan_Desingh

Output:

commQV57.PNG

Shani1
Contributor II
Contributor II
Author

Hi Saran, thanks for example, your inline table/script gives the expected results. i will try with original table and let us see what the outcome will be.