on 09-12-2008 8:50 PM
I am idoc to file scenario.
my requirement is ,
I have a quantity field.which is of length 15from IDOC.it has got 3 decimals.which means that last 3 digits are decimals
now my requirement is....
I need to take 6 digits before the decimal and 3 decimals and send it to the receiver.Total receiver field length is 9.At receiver we dont need to have decimal
For eg:
If we get 123456.789 from sender..then the should be sent as 123456789
If we get 123456789012.345 then this should be sent as 789012345
what should be done...any UDF..if so can i get the code....
One more thing is that,If we get 234.000 then we need to add zero infront and sent to Receiver
for eg:
234.000 then receiver should get 000234000
Edited by: Harsha reddy on Sep 12, 2008 9:55 PM
Hey
Use the following standar functions
Sender field->Multiple by 1000(this will remove the decimal)->formatNum(000000000)->substring("String",3,8)
Thanx
Aamir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Reddy,
Please try this. Use java 5.0 sdk
private String format(String strNumber){
String strNumberToFormat = strNumber;
String output = "";
if(strNumber.indexOf(".") > 0){
if(strNumber.length() > 10 ){
int i = strNumber.length() - 10;
strNumberToFormat = strNumber.substring(strNumber.length() - 10, strNumber.length());
}else{
strNumberToFormat = strNumber;
}
strNumberToFormat = strNumberToFormat.replaceAll(".", ""); //You may need to find right reg exp
output = strNumberToFormat.format("%08d", Integer.parseInt(strNumberToFormat));
}
return strNumberToFormat;
}
Regards
Unni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harsha
Here is the solution:
Source element
1. Use Arithmentic format number with number format as 0000000.000
2. Use Test function replace string with arguments
first argument- output of step 1
second argument as "."
thind argument constant without anychacter
3. write UDF with input as "a" and write code like below
return (a.substring(a.length()-9,a.length()));
Map step 3 output to target element
please let me know if it works fine.
Thanks
Sai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
could you please specify your reuirement exactly.
maybe its you could replace the decimal delimiter "." with empty space ""
afterwards you check the length of the content and take the last 9 characters.
if there less then 9 characters add a leading 0.
that it. you can achieve that with UDF.
does this meet your requirement?
Kind regards
Jochen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
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.