Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
aveeeeeee7en
Specialist III
Specialist III

Hierarchy Question

Hi Community

Kindly see the Attached QVW.

I have mentioned my requirement there as per the Example

Regards

Aviral

1 Solution

Accepted Solutions
Anonymous
Not applicable

add the load statement below above your first load and replace the old column with the new one in your hierarchy load.

Emp:

LOAD *,
    
if([Reporting To]='VACANT',DivisionalHead, [Reporting To]) as [Reporting To New];
LOAD
EmpID,
    
Name,
    
Department,
    
[Reporting To],
    
emp_code,
    
emp_location,
    
MANAGER_POSN,
    
DivisionalHead
FROM TESTDATA.qvd(qvd);

Hierarchy:
Hierarchy (EmpID,[Reporting To New],Name,Manager,Name,EmpTree,'/',Level)
LOAD *
RESIDENT Emp;
DROP TABLE Emp;

View solution in original post

5 Replies
Anonymous
Not applicable

add the load statement below above your first load and replace the old column with the new one in your hierarchy load.

Emp:

LOAD *,
    
if([Reporting To]='VACANT',DivisionalHead, [Reporting To]) as [Reporting To New];
LOAD
EmpID,
    
Name,
    
Department,
    
[Reporting To],
    
emp_code,
    
emp_location,
    
MANAGER_POSN,
    
DivisionalHead
FROM TESTDATA.qvd(qvd);

Hierarchy:
Hierarchy (EmpID,[Reporting To New],Name,Manager,Name,EmpTree,'/',Level)
LOAD *
RESIDENT Emp;
DROP TABLE Emp;

aveeeeeee7en
Specialist III
Specialist III
Author

Thank You Jsaradhi

Your Logic is working Perfectly

But I also want the MANAGER_POSN to be used in the Code.

In my example, there is one Manager who is blank but in future if there are 2 or more null than i identify with MANAGER_POSN.

Anonymous
Not applicable

just modify the load statements to something like:

LOAD *,
//     if([Reporting To]='VACANT',DivisionalHead, [Reporting To]) as [Reporting To New],
  if([Reporting To]='VACANT',SubField(link1,'_',1),[Reporting To]) as [Reporting To New],
  
if([Reporting To]='VACANT',SubField(link1,'_',2),MANAGER_POSN) as MANAGER_POSN_New;
LOAD EmpID,
    
Name,
    
Department,
    
[Reporting To],
    
emp_code,
    
emp_location,
    
MANAGER_POSN,
    
DivisionalHead,
    
DivisionalHead&'_'&MANAGER_POSN as link1

FROM
TESTDATA.qvd
(
qvd);

of course, now MANAGER_POSN_New and [Reporting To New] should be the fields you use. you can even drop the older fields at the end of the script if necessary.

aveeeeeee7en
Specialist III
Specialist III
Author

Thank You Very-2 Much for the Solution and devoting your time on this issue.

Regards

Aviral

Anonymous
Not applicable

np. good luck.