cancel
Showing results for 
Search instead for 
Did you mean: 

mapping issue

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey

Use the following standar functions

Sender field->Multiple by 1000(this will remove the decimal)->formatNum(000000000)->substring("String",3,8)

Thanx

Aamir

Former Member
0 Kudos

Hi Aamir,

what should be the format number here...considering, I am getting 123456.000 and 1234567890.123

Edited by: Harsha reddy on Sep 12, 2008 11:30 PM

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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