Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have some issues with apply map.
The scenario is:
I have 2 tables A and B
A has 2 columns ID1,ID2
B has 3 column ID3,ID4,ID5
The column ID2 contains values from ID3. Hence ID3 column is Master ID..
Thus while loading table B I want to add a flag if ID3 column in ID2 then mark the flag as 1 else 0.
How can I achieve this with applymap.
Regards,
Like this??
A:
Mapping LOAD
ID1,ID2 as ID3 ;
B:
LOAD
ID3,
ID4,
ID5,
If(ApplyMap('A', ID3 , Null()) ,1 , 0) as Flag
;
Or please share some sample app with some data.
Hi,
Use some thing like:
LOAD ID1,
if(ApplyMap('Abc',ID2,'0')=0,0,1),
ID3
FROM
(ooxml, embedded labels, table is Master);
Regards,
Pankaj
Or Please try like this...
Please find solution
Vikas
prma7799 There is no need to Alias the mapping field, but it must be the first column in the mapping table
A:
Mapping LOAD
ID2,ID1
;
B:
LOAD
ID3,
ID4,
ID5,
If(ApplyMap('A', ID3 , Null()) ,1 , 0) as Flag
Read more about Applymap() on the community
Don't join - use Applymap instead
https://www.quickintelligence.co.uk/applymap-is-it-so-wrong/
vinieme12 ,
Thanks Vineeth.
Initial:
Mapping
LOAD
ID2,
ID1
INLINE [
ID2, ID1
1, Rock
2, Brock
3, TripleH
4, StoneCold
];
MasterLaod:
LOAD
ID3,
ID4,
ID5
,ApplyMap('Initial',ID3,'Unkonwn'),
If(ApplyMap('Initial',ID3),0,1) as Flag
INLINE [
ID3, ID4, ID5
1, Rock, "People's Champ"
2, Brock, USA champ
3, TripleH, TagTeam
4, StoneCold, Universal WWE
5, Kane, Raw Champ
6, UnderTaker, Smackdown Champ
7, BigShow, Intercontenential
];