on 2022 Aug 18 6:39 PM
Hi Experts,
I have a conditional mapping which I am trying to acheive in the transformation file (BPC 11.1 NW)
IF(0PCOMPANY <> *STR() Then 0PCOMPANY ; IF(0CUSTOMER <> *STR() Then 0CUSTOMER; IF(0VENDOR <> *STR() Then 0VENDOR; *STR(I_NONE))))
Can I use <> operator in the IF condition of Transformation file?
I tried with concatenation
INTERCO=*IF(0PCOMPANY+0CUSTOMER+0VENDOR=*STR() then *STR(I_NONE); ..can't proceed from here.
Thanks,
Rohit
Request clarification before answering.
May be the following will work in transformation:
INTERCO=*IF(0PCOMPANY+0CUSTOMER+0VENDOR=*STR() then *STR(I_NONE); 0PCOMPANY+0CUSTOMER=*STR() then 0VENDOR; 0PCOMPANY=*STR() then 0CUSTOMER; 0PCOMPANY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
rohit.padala
<> is not supported in Transformation file. You can try a workaround. I think you are trying to check if 0PCOMPANY is not blank then 0PCOMPANY else if 0CUSTOMER is not blank then 0CUSTOMER and so on. If your starting character/digit of COMPANY, CUSTOMER and VENDOR is consistent you can try below.INTERCO=*IF(0PCOMPANY+0CUSTOMER=0PCOMPANY THEN 0PCOMPANY;0PCOMPANY(1:1)=*STR(C);0PCOMPANY;0CUSTOMER+0VENDOR=0CUSTOMER THEN 0CUSTOMER;0CUSTOMER(1:1)=*STR(P) THEN 0CUSTOMER;0PCOMPANY+0CUSTOMER+0VENDOR=0VENDOR THEN 0VENDOR;*STR(I_NONE))
0PCOMPANY(1:1)=*STR(C) Replace C with starting character of your COMPANY
0CUSTOMER(1:1)=*STR(P) Replace P with starting character of your CUSTOMER Unfortunately if starting characters are not consistent then you will need a routine (UJD_ROUTINE) for this.Hope it helps you.
Please upvote/accept if this helps
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
UJD_ROUTINE is not required
INTERCO=0PCOMPANY+*STR(_)+0CUSTOMER+*STR(_)+0VENDOR
And in conversion file you can use javascript to parse the line and check conditions.
P.S.
In conversion test:
IF %external% = "__" then "I_NONE"
IF %external% start with "__" then vendor part
IF %external% start with "_" then customer part
Else pcompany part
P.P.S
sample how to get customer part in js:
var external="1234_34lmlm5_678";
alert(external.slice(external.indexOf("_")+1,external.lastIndexOf("_")));
result is 34lmlm5
vendor part:
alert(external.slice(external.lastIndexOf("_")+1));
pcompany part:
alert(external.slice(0,external.indexOf("_")));
full logic:
alert(external=="__" ? "I_NONE" : (external.slice(0,2)=="__" ? external.slice(external.lastIndexOf("_")+1) : (external.slice(0,1)=="_" ? external.slice(external.indexOf("_")+1,external.lastIndexOf("_")) : external.slice(0,external.indexOf("_")))));
not very complex!
Line in conversion file:
js:%external%=="__" ? "I_NONE" : (%external%.slice(0,2)=="__" ? %external%.slice(%external%.lastIndexOf("_")+1) : (%external%.slice(0,1)=="_" ? %external%.slice(%external%.indexOf("_")+1,%external%.lastIndexOf("_")) : %external%.slice(0,%external%.indexOf("_"))))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but read help on IF function syntax:
*If(Condition1 then Action1;Condition2 then Action2;Default Action)
only single IF!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.