Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
renjithpl
Specialist
Specialist

If exists then show manager name

Hi All,

I have a table like this

EmpIDEmpNameMgrID
200Steve0
201Mark200
202Mathew201

the scenario here is, Steve doesnt have a manager, Steve is the manager of Mark, and Mark is the manager of Mathew,

My output table should look like

MgrIDManagerName
0-
200Steve
201Mark

Thanks and regards

Renjith

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Renjithpl,

Try this script

[TMP1]:

LOAD * INLINE [

EmpID,    EmpName,    MgrID

200,    Steve,        0

201,    Mark,        200

202,    Mathew,        201];

[tmpMapping]:

MAPPING

LOAD

    EmpID,

    EmpName

RESIDENT [TMP1];

[MGR]:

LOAD

    MgrID,

    APPLYMAP('tmpMapping',MgrID,'-')    AS [MgrName]

RESIDENT [TMP1];

DROP TABLE [TMP1];

Do let me know, if this one help you.

Regards,

Sokkorn

View solution in original post

2 Replies
Not applicable

Hi,

Attached an sample for your reference. Hope this resolve your issue.

Sokkorn
Master
Master

Hi Renjithpl,

Try this script

[TMP1]:

LOAD * INLINE [

EmpID,    EmpName,    MgrID

200,    Steve,        0

201,    Mark,        200

202,    Mathew,        201];

[tmpMapping]:

MAPPING

LOAD

    EmpID,

    EmpName

RESIDENT [TMP1];

[MGR]:

LOAD

    MgrID,

    APPLYMAP('tmpMapping',MgrID,'-')    AS [MgrName]

RESIDENT [TMP1];

DROP TABLE [TMP1];

Do let me know, if this one help you.

Regards,

Sokkorn