Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Friends,
I want to applymap in case of 3 columns where values in 1st two columns are repeating.
e.g.
Column1 Column2 Column3
A x 1
A y 2
C x 3
C y 4
E z 5
I could have loaded this table as it is. But 1st two columns are there in some other tables also and they are linked with specific logic.
Adding this table is creating multiple loops.
Hoping for earliest help.
Best Regards,
Happy Thoughts
Hi ,
You can do this by Creating 1 field by concatenating Column1 and Column2 and apply map .
Mapping Load
Column1&Column2 As Column,
Column3
...
use likee below
tab1:
Load * inline [
Column1 Column2 Column3
A x 1
A y 2
C x 3
C y 4
E z 5
];
Mapping
Map1:
Load
column 1,
column3
resident tab1;
Mapping
Map2:
Load
column 1,
column3
resident tab1;
drop table tab1;
add using two apply map to other table
hope this help
Hi,
Thanks, but it is not helping me.
Can you elaborate what you said in last line - "add using two apply map to other table"?
Thanks
Mapping
Map1:
Load
column 1,
column3
resident tab1;
Mapping
Map2:
Load
column 1,
column2
resident tab1;
drop table tab1;
applymaap('Map1',column1) as Column3
applymaap('Map2',column1) as Column2
//Applymap in case of 3 columns?.
TestMap:
Mapping
LOAD
Column3,
Column1 &'-' &Column2 as NewColumn
//Column3
INLINE [
Column1, Column2, Column3
A, x, 1
A, y, 2
C, x, 3
C, y, 4
E, z, 5
];
New:
LOAD
City ,
ID,
ApplyMap('TestMap',ID,'Unknown') as CombinedCols,
Subfield(ApplyMap('TestMap',ID,'Unknown'),'-',1) as 1,
Subfield(ApplyMap('TestMap',ID,'Unknown'),'-',2) as 2
INLINE [
City, ID
NewYork, 1
NeewJerssy, 2
Cal, 3
Alaska, 4
Nagpur, 5
];