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: 
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 (1)
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
MVP
MVP

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
MVP
MVP

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.