Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
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;
Hi Viswa,
I Think in apply map 3rd parameter would be the missing value not the field name.
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;
Want 11 to have Banana and 12 to have Grapes
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
That works! Thanks Rob!!