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: 
Not applicable

How to Create a Hierarchy

How do you create a collapsible hierarchy?  I need a tree view that is similar to this which will be imported from Excel. 

1.0 - Top Level 1

   1.1

      1.1.1

      1.1.2

   1.2

2.0 - Top Level 2

3.0 - Top Level 3

   3.1

       3.1.1

4.0 - Top Level 4

Top levels only would have a description attached to the number.  All of this is available in and Excel sheet where one column is the requirement number and the second field is the description.  Short descriptions are present for top levels.

For Example

Req #                    Description

1.0                        Top Level 1

1.1                         Requirement 1...............

1.1.1                      Requirement 1...............

1.1.2                      Requirement 1...............

2.0                        Top Level 2

2 Replies
MarcoWedel

Hi,

maybe one solution could be:

QlikCommunity_Thread_197528_Pic1.JPG

QlikCommunity_Thread_197528_Pic3.JPG

QlikCommunity_Thread_197528_Pic2.JPG

table1:

Hierarchy(ReqID,ParentReqID,[Req #],,ReqPathSource,'ReqPath')

LOAD Text([Req #]) as [Req #],

    Text([Req #]) as ReqID,

    Text(Left([Req #],Index([Req #],'.',-1)-1)&If(SubStringCount([Req #],'.')=1,'.0')) as ParentReqID,

    Text(If([Req #] like '*.0', [Req #]&' - '&Description, [Req #])) as ReqPathSource,

    Description

Inline [

    Req #, Description

    1.0, Top Level 1

    1.1, Requirement 1...............

    1.1.1, Requirement 1...............

    1.1.1.1, Requirement 1...............

    1.1.2, Requirement 1...............

    1.2, Requirement 1...............

    2.0, Top Level 2

    3.0, Top Level 3

    3.1, Requirement 1...............

    3.1.1, Requirement 1...............

    4.0, Top Level 4

    4.1, Requirement 1...............

    4.1.1, Requirement 1...............

    4.1.2, Requirement 1...............

    4.1.2.1, Requirement 1...............

    4.1.2.2, Requirement 1...............

    4.2, Requirement 1...............

    4.2.1, Requirement 1...............

    4.2.2, Requirement 1...............

    4.2.3, Requirement 1...............

];

hope this helps

regards

Marco

Not applicable
Author

This works perfect but is there also a way to keep track of the highest parent id and description.  Even if we are three levels down.

For example i need a variable with data that tells me that requirement 4.2.1 is under the category 4.0 - Top Level 4.

Thanks,