on 01-21-2011 1:41 PM
Hello Expert,
I have requirement in mapping where the QuantityShipped field values coming from the file and after transfomation the below output need to be mapped in the Idoc target filed MENGE. QuantityShipped filed defined as a sting in the datatype.
Input: 000000-18
Output: -18
Since I using the FormatNo function but not getting the required output.
FormatNo function works in case 000000018 so the output comes 18, but in case of -ve values it didn't works.
Please help. Can we acheive it by using without helping UDF?
Regards,
Sameer!
Hi Sameer Khanna,
I have successfully tested this UDF.
public String Negitive(String MENGE, Container container) throws StreamTransformationException{
if(!MENGE.contains("-"))
{
return Integer.parseInt(MENGE) + "";
}else{
MENGE = MENGE.replaceAll("-","");
return Integer.parseInt(MENGE) + "-";
}
}
Regards,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Expert,
CORRECTION:
I have requirement in mapping where the QuantityShipped field values coming from the file and after transfomation the below output need to be mapped in the Idoc target filed MENGE. QuantityShipped filed defined as a sting in the datatype.
Input: 000000-18
Output: 18-
Since I'm using the FormatNo function but not getting the required output.
Please help. Can we acheive it by using without helping UDF?
Regards,
Sameer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hello Expert,
>
> I have requirement in mapping where the QuantityShipped field values coming from the file and after transfomation the below output need to be mapped in the Idoc target filed MENGE. QuantityShipped filed defined as a sting in the datatype.
>
> Input: 000000-18
> Output: -18
>
> Since I using the FormatNo function but not getting the required output.
>
> FormatNo function works in case 000000018 so the output comes 18, but in case of -ve values it didn't works.
>
> Please help. Can we acheive it by using without helping UDF?
>
> Regards,
> Sameer!
Try this:
Imports: java.lang.;java.util.;
public void UDF(String input_string,ResultList result,Container container){
String[] temp;
/* delimiter */
String delimiter = "-";
String result;
/* given string will be split by the argument delimiter provided. */
temp = input_string.split(delimiter);
result = delimiter.concat(temp[1])
result.addValue(result);
}
Edited by: spantaleoni on Jan 21, 2011 2:52 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 |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.