on 03-29-2011 6:26 PM
Hi Consultants,
I am working on IDOC to File scenario. I need to implement a specific requirement of our client. i.e. something like below;
Vendor number can be any thing like 1AA000000 / 1AA000001/1AB000000/... ect till 1ZZ999999.
if the vendor number is in between 1AA000000 -1ZZ999999 then the target value should assign as 'Internal' else should assing as 'External'.
How to compare that the value of vendor is in between IAA000000 to 1ZZ999999 in mapping?
Appreciate your help.
Thanks in advance.
Regards,
Nausheen
Hi Nausheen,
Try this simple UDF with the power of regular expression.
import java.util.regex.*;
public static String checkRange(String vendorNumber) {
if(Pattern.matches("1[A-Z]{2}[0-9]{6}",vendorNumber))
return "Internal";
else
return "External";
}
Hope it helps !!
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nausheen,
The UDF provided by Sunil will best work for you. For more information on the clas Pattern; you can refer the following thread:
http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html
Also, the value mapping (or fix value) will not be a good idea in this case as you will have to write/provide a very big list of mapping, thats close to impossible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Have the list of possible Vendor Numbers in hand and Implement Values Mapping in your Interface
/people/community.user/blog/2007/01/08/valuemapping-using-the-graphical-mapping-tool
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try creating an UDF and using the varName.substring(); method. Then you can compare in separated pieces the string. For example
String var = "1AA000000";
if (var.substring(3).compareTo("000000") < 0 && var.substring(3).compareTo("999999") > 0)
{
//compare now the "AA" and "ZZ" with the same logic;
}
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#substring(int, int)
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#compareTo(java.lang.Object)
EDIT: Moreover, those functions are available in the Mapping program creation, but this should give a clue on the order it should be done.
Edited by: Lucas Santos on Mar 29, 2011 7:38 PM
Edited by: Lucas Santos on Mar 29, 2011 7:53 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
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.