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

Hierarchy tree

Hi,

I'd like to make a hierarchy tree out of my database.

Here is an example of my data:

Level    GroupID       GroupName       IdGroupparent

0            22550        Test1                

1            22551        Test2                  22550

1            22552        Test3                  22550

1            22553        Test4                  22550

2            22554        Test5                  22551

2            22555        Test6                  22551

3            22556        Test7                  22554

4            22557        Test8                  22556

Basically I'd like to build a view like the following suggested in this post: Hierarchy List

However they're using the 'Path' to build the table below. I'd like to automatically be able to organize my Groups from top to bottom.

I've got a maximum of 6 levels.

Result would look like this:

Test1

         Test2

                   Test5

                           Test7

                                   Test8

                   Test6

         Test3

         Test4

Sorry I'm a bit new to Qlikview, if you can provide me some help that would be great.

Thanking you in advance,

Cédric

12 Replies
Nicole-Smith

Hierarchy:

HIERARCHY([G_ID],[IdGroupe_Parent],[G_Nom],,[G_Nom],[HIERARCHY],'|',[HIERARCHY DEPTH])

SQL SELECT G_ID, IdGroupe_Parent,G_Nom

FROM ActiveDirectory.dbo."AD_Comptes_ArbActive_V3";

Not applicable
Author

Sorry but I can't manage to reproduce the given example... I get my newly created tables HIERARCHY and HIERARCHY DEPTH but the data won't agregate as mentionned.

If I understand the path field is automatically created but in my case unfortunately it doesn't. It's only displaying my G_Nom all alone without the path of child/parent.

Otherwise I can overcome this problem in SQL...

Hierarchy:

HIERARCHY([G_ID],[IdGroupe_Parent],[G_Nom],,[G_Nom],[Tree],"|",[G_Niveau])

SQL SELECT G_ID, IdGroupe_Parent,G_Nom

FROM ActiveDirectory.dbo."AD_Comptes_ArbActive_V3";

Here is part of my tables:

tables.jpg

hic
Former Employee
Former Employee

It is difficult for us to find the error without a data sample. However, I can see one small problem: you use double quotes around the path delimiter:

     "|"

This is wrong. It must be single quotes:

     '|'

See more on QlikView Quoteology

HIC