Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rahulsingh12
Contributor III
Contributor III

Apply Map Function

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,

9 Replies
prma7799
Master III
Master III

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.

passionate
Specialist
Specialist

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

prma7799
Master III
Master III

Or Please try like this...

vikasmahajan

Please find solution

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vinieme12
Champion III
Champion III

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

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

prma7799
Master III
Master III

vinieme12‌ ,

Thanks Vineeth.

ysj
Creator
Creator

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

];



ysj
Creator
Creator

Result for above  comment.PNG