Global Sterling Data Exchange

 View Only
  • 1.  fractional part getting removed when its 0

    Posted Tue July 09, 2024 06:03 PM

    The fractional part is getting removed when fractional part is 00. I want the output to match the input format exactly

    current behaviour:

    if input 

    is 100.00 , output generated is 100if input is 100.05 then output is fine which is 100.05

    Expected behaviour:

    if input is 100.000 then output should be 100.000

    if input is 100.00 then output should be 100.00

    Format in type tree is ####.[##].

    Decimal min is 0

    Decimal max is not mentioned



    ------------------------------
    Kavitha Rout
    ------------------------------



  • 2.  RE: fractional part getting removed when its 0

    Posted Thu July 11, 2024 01:03 PM

    Hi Kavitha,

    Sounds like you want to define it as a text field if you need to preserve whatever number format comes in and it could be variable.  Then you can use TEXTTONUMBER() if you need it for a calculation.  The current number format you're using is making the decimal part optional and because there is no mathematical difference between 100 and 100.00 or 100.0000 - it will always come out as 100 when defined as ###.[##].  If it is text/character it will come out exactly as it comes in since it is not treating it as a number for presentation purposes.

    Happy mapping!



    ------------------------------
    Lisa Edwards
    Software Engineer / Subject Matter Expert
    Rainbow Data Systems, Inc
    ------------------------------



  • 3.  RE: fractional part getting removed when its 0

    Posted 5 days ago

    I converted number to text got the size (number of zeros) and then did round.

    ROUND (fieldname,SIZE(WORD(NUMBERTOTEXT (fieldname),".",2))) .

    This worked



    ------------------------------
    Kavitha Rout
    ------------------------------