Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have around 50 if Conditions on the same Field like salesman 1 = 'XXX' then name = ÝYYY', like below I have to check for 50 values while loading the data. is there any alternate way to replace IF with another function?
LOAD * ,
if([Salesman 1]='MKAHN','Outside',
if([Salesman 1]='TZERB','Outside',
if([Salesman 1]='KNIBL','Outside',
if([Salesman 1]='ERAMO','Outside',
if([Salesman 1]='MNOBL','Outside',Salesmantype_old ))))) as Salesmantype;
I would suggest to use ApplyMap() function with Mapping Load
We can do many ways?
1) Like what you done
2) Replace function with every time - Not recommended
3) Pick Match as follows - Recommended
Pick(Match([Salesman 1], 'MKAHN', 'TZERB', 'KNIBL', 'ERAMO', 'MNOBL'), 'Outside',Salesmantype_old) as Salesmantype
4) Mapping Table for all 50 rows with same name - Recommended
I would suggest to use ApplyMap() function with Mapping Load
@kushalthakral Try and let us know where it is not working 🙂
@Anil_Babu_Samineni I think what @kushalthakral is trying to say is that you need if instead of Pick to do this
If(Match([Salesman 1], 'MKAHN', 'TZERB', 'KNIBL', 'ERAMO', 'MNOBL'), 'Outside', Salesmantype_old) as Salesmantype
or you need this
Pick(Match([Salesman 1], 'MKAHN', 'TZERB', 'KNIBL', 'ERAMO', 'MNOBL') + 1, Salesmantype_old, 'Outside', 'Outside', 'Outside', 'Outside', 'Outside') as Salesmantype
Pick will need n+1 number of arguments for n number of arguments in Match.
I agree with you @sunny_talwar and @kushalthakral