Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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
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
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;