Skip to Content
author's profile photo Former Member
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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • 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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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)

    public String AddLeading(String a,String b,Container container){

    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);

    }

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2011 at 06:42 AM

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

    Regards,

    Sanghamitra

    Add a comment
    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;
    }
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.