Former Member

# query about decimal point field in mapping

hi,

In interface one field is supposed , Both dollars and cents will be formatted with an implied decimal point before the last two digits in the data.

for exm : input is -620.27. then output should be -000062027. Maximum length of the field is 10.

if input is 44.44.then output should be 0000004444.

In this way.

Name of the field is Pay_Amount.

how do i get this mapping?

Regards,

Sanghamitra

10|10000 characters needed characters exceeded

### Related questions

• Posted on Aug 19, 2011 at 03:57 PM

Hi,

Use arthimatic unction 'multiply' and 'formatNumber'.

1.multiply with 100

2.Then furmat number with 0000000000.

Regards,

Raghu_Vamsee

10|10000 characters needed characters exceeded
• Former Member
Posted on Aug 19, 2011 at 03:58 PM

Use the replace string function to replace decimal point with null. Then pass the value to a udf.

Write a udf (value cached) and pass the input a= value from Pay_Amount and b - required length of field (10)

String temp = new String(String.valueOf(Integer.parseInt(a)));

int temp1 = Integer.parseInt(b);

for(int i = 0; (temp1 - a.length()) > i ; i++)

{

temp = "0" + temp;

}

return(temp);

}

10|10000 characters needed characters exceeded
• Former Member
Posted on Aug 22, 2011 at 06:42 AM

How do i find the length of the substring using UDF ?

Regards,

Sanghamitra

10|10000 characters needed characters exceeded
• Posted on Aug 22, 2011 at 07:25 AM

chk this UDF:

input will be var1

Execution type "Single value"

```String a = var1.replace("." , "");
int len=a.length();
if(a.startsWith("-"))
{
String k1 = a.replace("-","");
for(int i=0;i<10-len;i++)
{
k1="0" +k1;
}
return ("-" + k1) ;
}
else
{
for(int i=0;i<10-len;i++)
{
a ="0" +a;
}
return  a;
}
```