on 03-06-2013 1:42 AM
Dear Experts,
How to write java code (udf) for below requirement?
For example, in source file, Brand = 'BK' and customer code = '5123' (starts with 5 ) then print Value "X" else value "Y".
Thank you.
Deva
Hi,
In Message Mapping you can handle with standar functions.
Otherwise you can check this javacode
String sResult = null;
if(Brand.equalS("BK") && CustomerCode.startsWith("5"))
result = "X";
else
result = "Y";
return result;
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Luis,
Thank you. but my code gives small syntax error as below.
if (Brand.equalsIgnoreCase ("BK") && CustNo.startsWith("5")){
return "3299970";
} else {
return "3299971";
}else if (Brand.equalsIgnoreCase ("DQ") && CustNo.startsWith("5")){
return "3299972";
} else {
return "3299973";
}else if (Brand.equalsIgnoreCase ("SW") && CustNo.startsWith("5")){
return "3299974";
} else {
return "3299975";
}else if (Brand.equalsIgnoreCase ("SZ") && CustNo.startsWith("5")){
return "3299976";
} else {
return "3299977";
}else if (Brand.equalsIgnoreCase ("PZ") && CustNo.startsWith("5")){
return "3299978";
} else {
return "3299979";
}else (Brand.equalsIgnoreCase ("CF") && CustNo.startsWith("5")){
return "3299980";
} else {
return "3299981";
}
Can you clarify your logic
For example:
If, Brand = 'BK' and customer code = '5123' (starts with 5 ) then print Value "3299971" else value "Y then ...etc
The sintax is incorrect because always return else condition.
for example return "3299971"; return "3299973";return "3299978";
if (Brand.equalsIgnoreCase ("BK") && CustNo.startsWith("5")){
return "3299970";";
}else if (Brand.equalsIgnoreCase ("DQ") && CustNo.startsWith("5")){
return "3299972";
Dear Deva,
Though your query has been answered but for your requirement you could always use standard node functions.
You can achieve your reqrmnt using EqualS, AND and IfThenElse function and its always preferred to use node over UDF.
Regards
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.