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

Find the Final Node on Hierarchy

Hello, I have table having ID, PARENT_ID , FULL_PATH and please find the sample data below.

IDPARENT_IDFULL_PATH
1 Application
21Application\AAR2 Test 8-11-2014
31Application\AAR3 Test 8-11-2014
43Application\AAR3 Test 8-11-2014\AAR3 Asset 1
53Application\AAR3 Test 8-11-2014\Asset 2 8-11-2014
63Application\AAR3 Test 8-11-2014\Test 8-27-2014
71Application\Corporate Security
87Application\Corporate Security\Cyber Security
98Application\Corporate Security\Cyber Security\Nexpose
109Application\Corporate Security\Cyber Security\Nexpose\Admin
119Application\Corporate Security\Cyber Security\Nexpose\Admins
129Application\Corporate Security\Cyber Security\Nexpose\Web Interface
138Application\Corporate Security\Cyber Security\Servers
1413Application\Corporate Security\Cyber Security\Servers\Vulnerability Scanner
1514Application\Corporate Security\Cyber Security\Servers\Vulnerability Scanner\Admins
1614Application\Corporate Security\Cyber Security\Servers\Vulnerability Scanner\Users
177Application\Corporate Security\Pro-Watch
1817Application\Corporate Security\Pro-Watch\Admin
1917Application\Corporate Security\Pro-Watch\Badging
2017Application\Corporate Security\Pro-Watch\Reporting
2117Application\Corporate Security\Pro-Watch\User

I want load final child on the above hierarchy table. Please find the sample out put.

IDPARENT_IDFULL_PATH
21Application\AAR2 Test 8-11-2014
43Application\AAR3 Test 8-11-2014\AAR3 Asset 1
53Application\AAR3 Test 8-11-2014\Asset 2 8-11-2014
63Application\AAR3 Test 8-11-2014\Test 8-27-2014
109Application\Corporate Security\Cyber Security\Nexpose\Admin
119Application\Corporate Security\Cyber Security\Nexpose\Admins
129Application\Corporate Security\Cyber Security\Nexpose\Web Interface
1514Application\Corporate Security\Cyber Security\Servers\Vulnerability Scanner\Admins
1614Application\Corporate Security\Cyber Security\Servers\Vulnerability Scanner\Users
1817Application\Corporate Security\Pro-Watch\Admin
1917Application\Corporate Security\Pro-Watch\Badging
2017Application\Corporate Security\Pro-Watch\Reporting
2117Application\Corporate Security\Pro-Watch\User

Please help me how we can do....

6 Replies
Not applicable
Author

Hi dathu,

please ask ur question clearly .... do u mean ur child means full_path or what ?

Not applicable
Author

FULL_PATH refers as a Tree and I want to load Final Node of FULL_PATH into report..

Not applicable
Author

FULL_PATH is unbalanced (n-level nodes) tree  and I want to load nth node  FULL_PATH on the tree.

kuba_michalik
Partner - Specialist
Partner - Specialist

Load first table, then do a resident load on it using the following condition:

Where not Exists(PARENT_ID, ID)

(remember to add NoConcatenate before this load or it will auto-concatenate)

Then drop the original table.

This will load only the nodes which have no descendants, so they must be the final nodes (leaves, or whatever the proper terminology is...)

MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_138536_Pic1.JPG.jpg

QlikCommunity_Thread_138536_Pic2.JPG.jpg

or

QlikCommunity_Thread_138536_Pic3.JPG.jpg

QlikCommunity_Thread_138536_Pic4.JPG.jpg

tabApplications:

Hierarchy (ID, PARENT_ID, NodeName,, NodeName, PathName, '\', Depth)

LOAD ID,

    PARENT_ID,

    FULL_PATH,

    SubField(FULL_PATH,'\',-1) as NodeName

FROM [http://community.qlik.com/thread/138536] (html, codepage is 1252, embedded labels, table is @1);

Left Join

LOAD ID,

    If(FieldIndex('PARENT_ID', ID),Dual('No',0),Dual('Yes',-1)) as IsTerminalNode

Resident tabApplications;

hope this helps

regards

Marco

anbu1984
Master III
Master III

Check this qvw

vParntId=Concat(DISTINCT Chr(39) & PARENT_ID & Chr(39), ',')

Use the expression MaxString({<ID-={$(vParntId)}>} FULL_PATH)