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: 
prabhu0505
Specialist
Specialist

Hierarchy Vs Hierarchy belongs to

Dear All,

  Can anybody explain me what's the difference between Hierarchy and Hierarchy belongs to?

Thanks & Regards,

Saravana Prabhu

8 Replies
prabhu0505
Specialist
Specialist
Author

Any Replies are really very much appreciated..

Not applicable

Hi Saravana,

look for this discussion:

     http://community.qlik.com/thread/46580

Good Luck!

Rainer

prabhu0505
Specialist
Specialist
Author

Thanks for your reply Rainer..

The discussion is about "Hierarchy belongs to" only but I'm looking for comparison.

Thanks & Regards,

Saravana Prabhu

brian_booden
Partner Ambassador
Partner Ambassador

Hi Saravana,

Hierarchy is used to create an Expanded Nodes table, where each level in the hierarchy is stored in a seperate field.  This makes it ideal for use in a listbox treeview, or a pivottable.

HierarchyBelongsTo is used to create an Ancestors table, which contains one record for every child-ancestor relation found in the data.  This makes it better suited for allowing selection of entire trees of data.

Does that help?

Regards,

Brian

prabhu0505
Specialist
Specialist
Author

Hi Brian,

  Theoretically now I'm comfortable I guess..

Can you pls. share some example?

Thanks & Regards

Saravana Prabhu

prabhu0505
Specialist
Specialist
Author

Anybody has examples on this context?

Thanks & Regards,

Saravana Prabhu

Not applicable

Prabhu0505,

   Its a simple example:

ORGANOGRAMA:

Hierarchy(COD_DEPARTAMENT, COD_DEPARTAMENT_UP,SIG_DEPARTAMENT,SIG_DEPARTAMENT_UP,SIG_DEPARTAMENT,PATH,'/','LEVEL')

LOAD COD_DEPARTAMENT, COD_DEPARTAMENT_UP, SIG_DEPARTAMENT

INLINE [

    COD_DEPARTAMENT, COD_DEPARTAMENT_UP, SIG_DEPARTAMENT

    1, , COMPANY 1

    2,1, DEPARTAMENT 1

    3,1, DEPARTAMENT 2

    4,1, DEPARTAMENT 3

    5,1, DEPARTAMENT

    6, , COMPANY 2

    7,6, DEPARTAMENT 1

    8,6, DEPARTAMENT 2

    9,6, DEPARTAMENT 3

    10,6, DEPARTAMENT 4

];

HIERARQUIA:

HierarchyBelongsto (COD_DEPARTAMENT, COD_DEPARTAMENT_UP, SIG_DEPARTAMENT, CODIGO, UNIDADE, HLEVEL)

LOAD

COD_UNIDADE,

COD_UNIDADE_PAI,

SIG_UNIDADE

Resident ORGANOGRAMA;

Anonymous
Not applicable

Hi. If you have 2 levels, then hierarchybelongsto makes no differences at all. With 3 levels, the difference is not that relevant but there is, and that's where it starts, basically is just to have a Parent ListBox that works better.

Let say you have 5 levels.

You select a parent in level 3. Hierarchy (simple one) will associate it with just its parent in level 2, and children in level 4. That's it, 1 level up, 1 level down.

But with hierarchybelongsto It will ALSO relate it with all ascendance and descendance. So it will know that the one selected (at level 3) has a boss in level 2, and also the superior boss in level 1 (Boss of his Boss, Parent of his parent). And not only descendance (children) directly at level 4, but also has hierarchy over some grandchildren/interns in level 5.

The more levels the more useful and notorious it becomes. But then again, only when selecting on the parent field which sometimes may be necessary, some other times not.