on 07-29-2010 1:22 PM
Hi there,
I have a requirement in which I have to pick up the last value of the input string.
I don't know the field length, it could be 10 line, it could be 4 line and it could be even 1 line.
Another problem is that the field contains all the alphanumeric values so the sort function is not working.
I believe I need to write a UDF but not sure exact what and how.
Can some body please help me solving this issue.
Input.
1.Abc
2.abc123atxx.com
3.(980)771-2341
4.
5.518VR50V58AD10DSAYBDSAFDSIEGHA:1
In that case I only need to pickup the last value i.e. 518VR50V58AD10DSAYBDSAFDSIEGHA:1
Output
518VR50V58AD10DSAYBDSAFDSIEGHA:1
Note:
1. Length is unknown
2. Alphanumeric data
Thanks,
hi iqbal,
u can write the following UDF.it should work fine.
only 1 input is enough
queue type/Execution type = Queue;
int length = var1.length -1;
result.addValue(var1[length]);
regards
biplab
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can write a UDF.
int Length=Integer.parseInt(SourcevalueLength);
int requiredLength=Integer.parseInt(RequiredLength);
if(Length<=requiredLength)
return(SourceValue);
else
return SourceValue.substring((Length-requiredLength),Length);
just a heads up.
Cheers,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi karthick Lakkar,
Thanks for your quick response but unfortunately I am getting mapping exception.
What I did is create a UDF with 2 input
INPUT
a string
b string
and then this code
int Length=Integer.parseInt(a);
int requiredLength=Integer.parseInt(b);
if(Length<=requiredLength)
return(a);
else
return a.substring((Length-requiredLength),Length);
I am wondering about the input as well.
At present I am doing
KTEXT + KTEXT --- UDF
+ does represent concat, means same input will go to the UDF
This is the error which I am getting
Exception:[java.lang.NumberFormatException: For input string: "Kevin Farrar"] in class com.sap.xi.tf._MM_XXXXXXXXXXXXXX_ method calculate[Kevin Farrar, Kevin Farrar, com.sap.aii.mappingtool.tf7.rt.Context@6dbf19db]
Hi karthick Lakkar...
I am bit confused about the 3 point.
public String calculate(String SourcevalueLength, String RequiredLength, String SourceValue, Container container) throws StreamTransformationException
{
int Length=Integer.parseInt(SourcevalueLength);
int requiredLength=Integer.parseInt(RequiredLength);
if(Length<=requiredLength)
return(SourceValue);
else
return SourceValue.substring((Length-requiredLength),Length);
}
I am confused about the input now.
Could you please tell me the input which connects with the UDF
at present I am connecting all the 3 inputs of KTEXT to UDF.
Please advice.
Thanks
User | Count |
---|---|
84 | |
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.