Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vijetas42
Specialist
Specialist

Hierarchy in qlikview

Hi All,

I have data like below,

   ID            Name

10Eng
1010Eng
101010Energy Equipment & Services
10101010Oil & Gas Drilling
10101020Oil & Gas Equipment & Services
101020Oil
10102010Integrated Oil & Gas
10102020Oil & Gas Exploration & Production
10102050Coal & Consumable Fuels
15Materials
1510Materials

where I suppose to create hierarchy like, suppose 10 15 Should be my parent node then for 10 level 1 should be 1010 in 1010 i will have 101010 in 101010 will have next level 10101010

like, expected output would be,

         ID1 Name1             ID2    Name2                          ID3      Name3                                ID4          Name4

10Eng1010Eng101010Energy Equipment & Services10101010Oil & Gas Drilling
10Eng1010Eng101010Energy Equipment & Services10101020Oil & Gas Equipment & Services

Regards,

Vijeta

6 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

to use hierarchy you need to start from a table containing your object, it's id and it's parent id.
so you need to process your table before in order to add this field.

QlikView Qlik Sense consultant
kfoudhaily
Partner - Creator III
Partner - Creator III

voir exemple en PJ

QlikView Qlik Sense consultant
vijetas42
Specialist
Specialist
Author

Couldn't understand.

you are just creating parent and node where, my requirement is,

10->1010->101010->10101010

10->1010->101010->10101020

10->1010->101020->10102010

rubenmarin

Googd sample, adding a 2nd hierarchy and editing the way ParentId is created (left(ID,len(ID)-2)) the result can be closer.

kfoudhaily
Partner - Creator III
Partner - Creator III

I have created parent Id the way I understood your requirement.

if there is other rules to generate this field feel free to do it or explain them in order to be able to provide a more suitable suggestion.

the essential is that you need to have in the same starting table, the id of the object and it's parent, other wise the hierarchy fonction won't work.

regards,

QlikView Qlik Sense consultant
kfoudhaily
Partner - Creator III
Partner - Creator III

check this version

table:

load *,

left(ID,len(ID)-2) as ParentID // if len(ID)=2 then len(ID)-2=0 and parentid=id

;

LOAD * INLINE

[

ID,        Name

10, Eng

1010, Eng

101010, Energy Equipment & Services

10101010, Oil & Gas Drilling

10101020, Oil & Gas Equipment & Services

101020, Oil

10102010, Integrated Oil & Gas

10102020, Oil & Gas Exploration & Production

10102050, Coal & Consumable Fuels

15, Materials

1510, Materials

];

Hierarchy(ID,ParentID,Name)

load * resident table;

drop table table;

QlikView Qlik Sense consultant