on 08-22-2006 12:31 PM
Hi All,
In my scenario mapping problem i.e source field is Account name and my target fields are Name1 and Name2.
If the Account Name is greater than 35 chars long it should be split over Name1 and Name2 fields.pls gudie me , how to split the message in the message maping.
Thanks and Regards,
Ramesh
Hi,
Can u please give in detail if the length is greater than 35 characters,how do u wan the account name to be split as name1 and name2.U didnt specify the separator depending on which the name has to be split.
cheers
jithesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ramesh,
Write 2 UDF's. Both will take the input as the Account Name.
First UDF, check if AccountName lenght is less than 35 , if yes, output it as such and map it to NAME1. Else, Split it to get 1st 35 charcters.
Second UDF, check if AccountName length is greater than 35 , Split it to get the charcters after 35 charcters and output it else, output a Blank String.
Regards,
Bhavesh
Hi Joslyn,
Thanks for reply.
I done maping like this
1)Accountname--->substring-->name1 in this case i set substring starting postion is 0 and ending postion is 35.
2)Accountname->Substring-->name2 in in this case i set substring starting postion is 35 and ending postion is 70.
While testing map i got Runtime Mapping Exception.
Error is like this.
RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:target_fl_MT/name1. The message is: Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 35] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring[asdfghj, com.sap.aii.mappingtool.tf3.rt.Context@41b0ca]
pls help me this
Thanks,
ramesh
> 1)Accountname--->substring-->name1 in this case
> se i set substring starting postion is 0 and ending
> postion is 35.
> 2)Accountname->Substring-->name2 in in this
> is case i set substring starting postion is 35 and
> ending postion is 70.
Accountname
concat - substring(0,35) - trim - name1
constant(35 spaces)/
Accountname
concat - substring(35,35) - trim - name2
constant(70 spaces)/
Regards
Stefan
Ramesh,
Assume a is the input parameter,
<b>UDF 1,</b>
int len=a.length();
String Name1="";
if(len>35){
Name1=a.substring(0,34);
}
else{
Name1=a;
}
return Name1;
<b>UDF2:</b>
int len=a.length();
String Name2="";
if(len>35){
Name2=a.substring(35,len-1);
}
else{
Name2="";
}
return Name2;
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ALL,
any help for java UDF.
thanks
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use substring method (not substring standard function) in UDF, like this:
UDF1 (String input is the input parameter):
if (input.length() > 35) {
return input.substring(0, 35);
}
return input;
UDF2:
if (input.length() > 35) {
return input.substring(35);
}
return null; // or return ""; , depending on your need
Regards,
Henrique.
Hi,
Can u please give in detail if the length is greater than 35 characters,how do u wan the account name to be split as name1 and name2.U didnt specify the separator depending on which the name has to be split.
cheers
jithesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.