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

script

Hi All,

Hi All,

below is the scenario , i want to get employee's manager's name in new columns. how can i achieve it in script

sample1.PNG

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi,

maybe like this

Temp:
LOAD * Inline [
eid,ename,mname,mid
1,sam,john,2
2,john,xyz,3
3,xyz,abc,4
4,abc,acc,5]
;
LOAD *,Lookup('ename','eid',mid,'Temp') as NewColumn
Resident Temp;
Drop Table Temp;

Regards,

Antonio

View solution in original post

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use a mapping table. Assuming that all intermediate managers are employees as well, everybody will occur once in the ename column.

MapEmp2Mgr:

MAPPING

LOAD ename, mname

RESIDENT OriginalTable;

Then use an applymap to translate the mname value into the managers name, like in

:

ApplyMap('MapEmp2Mgr', mname, '-') AS [new column],

:

You can do this using ID's as well, but maybe you'll need an extra JOIN or Mapping Table to translate final manager ID's into manager names.

Best,

Peter

jonathandienst
Partner - Champion III
Partner - Champion III

You need to provide more information for meaningful help

Qlik Community Tip: Posting Successful Discussion Threads

Qlik Community Tip: How to Get Answers to Your Post

It would also be a good idea to upload a sample qvw containing some representative sample data (it need not be real, but must illustrate the data and your requirement.

Preparing examples for Upload - Reduction and Data Scrambling

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
antoniotiman
Master III
Master III

Hi,

maybe like this

Temp:
LOAD * Inline [
eid,ename,mname,mid
1,sam,john,2
2,john,xyz,3
3,xyz,abc,4
4,abc,acc,5]
;
LOAD *,Lookup('ename','eid',mid,'Temp') as NewColumn
Resident Temp;
Drop Table Temp;

Regards,

Antonio

hari8088
Creator
Creator

Hi,

Try this.

Temp:

LOAD * Inline [

eid,ename,mname,mid

1,sam,john,2

2,john,xyz,3

3,xyz,abc,4

4,abc,acc,5];

map:

Mapping LOAD

eid as key,

ename

Resident Temp;

Final:

LOAD *,

ApplyMap('map',mid,'') as newmap

Resident Temp;

DROP Table Temp;