Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Apply Map - Value from Another Field

IDMAPPING:

MAPPING LOAD
     OLDID as ID,

     NEWID

FROM A;

A:

OLDID  NEWID

1             11

2             12

B:

ID   Name

1     Apple

11   Banana

2     Orange

12   Grapes

FINALB:

LOAD

ApplyMap('IDMAPPING', ID,ID),

Name

FROM B

FinalB:

ID   Name

11     Apple

11   Banana

12     Orange

12   Grapes

WANT:

FINALTABLE:

ID   Name

11   Banana

11   Banana

12   Grapes

12   Grapes

Is this possible?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you want to map twice -- once for the id followed by an applymap to get the name.

IDMap:

MAPPING LOAD * INLINE [

oldid, newid

1,11

2,12

]

;

InputB:

LOAD * INLINE [

ID,  Name

1,    Apple

11,  Banana

2,    Orange

12,  Grapes

]

;

NameMap:

MAPPING LOAD

ID, Name

Resident InputB

;

FINALB:

NoConcatenate

LOAD

ApplyMap('IDMap', ID) as ID,

ApplyMap('NameMap', ApplyMap('IDMap', ID,ID)) as Name

Resident InputB

;

Drop TABLE InputB;

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

5 Replies
vishsaggi
Champion III
Champion III

Try this:

A:

LOAD * INLINE [

OLDID,  NEWID

1,11

2,12

];

IDMAPPING:

MAPPING LOAD

     OLDID as ID,

     NEWID

Resident A;

B:

LOAD * INLINE [

ID,   Name

1 ,    Apple

11,   Banana

2 ,    Orange

12,   Grapes

];

NoConcatenate

FINALB:

LOAD

ApplyMap('IDMAPPING', ID,ID) AS ID,

Name

Resident B;

DROP TABLE B;

arjakumar
Contributor III
Contributor III

Hi Viswa,

I Think in apply map 3rd parameter would be the missing value not the field name.

Anonymous
Not applicable
Author

Hi Vishwarath

I tried the code below - all i added was dropping table A. As per the results the new ID has the old name.

A:

LOAD * INLINE [

OLDID,  NEWID

1,11

2,12];

IDMAPPING:

MAPPING LOAD

     OLDID as ID,

     NEWID

Resident A;

B:

LOAD * INLINE [

ID,   Name

1 ,    Apple

11,   Banana

2 ,    Orange

12,   Grapes];

NoConcatenate

FINALB:

LOAD

ApplyMap('IDMAPPING', ID,ID) AS ID,

Name

Resident B;

DROP TABLES A, B;

TestPci.png Want 11 to have Banana and 12 to have Grapes

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you want to map twice -- once for the id followed by an applymap to get the name.

IDMap:

MAPPING LOAD * INLINE [

oldid, newid

1,11

2,12

]

;

InputB:

LOAD * INLINE [

ID,  Name

1,    Apple

11,  Banana

2,    Orange

12,  Grapes

]

;

NameMap:

MAPPING LOAD

ID, Name

Resident InputB

;

FINALB:

NoConcatenate

LOAD

ApplyMap('IDMap', ID) as ID,

ApplyMap('NameMap', ApplyMap('IDMap', ID,ID)) as Name

Resident InputB

;

Drop TABLE InputB;

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Anonymous
Not applicable
Author

That works! Thanks Rob!!