on 07-01-2011 5:06 PM
I ahve to create a UDF, basically it states that if variable #1 is equal to "CostCenter" then I will have to take the last 4characters of variable #2, How would that be written in a UDF?
Create two arguments var1 and var2 as type String and method name returnLastFourChars
Do the following
public String returnLastFourChars(String var1, String var2, Container container) throws StreamTransformationException{
String result="";
if (var1.equals("CostCenter")){
result = var2.substring(var2.length()-4, var2.length());
}
return result;
}
Map var1,var2 to the input of the UDF function and output map to the target field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
YOu might use the below code:
SubStringEx subEx = new SubStringEx();
if var1.equals("CostCenter")
{
String last4Digits = subEx.getLastnCharacters(var2,4);
}
return last4Digits;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use standard functions to achieve your issue. IF stateme
nt and text operations
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.