IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Decimal digits in WTX

    Posted 10/14/13 11:13 PM

    Originally posted by: Rshya


    Hi All,

     

    I have an input field when its value is 4.99900 then i need to see 4.999 in the output. While if the input has 4.99000 the i need to see 4.99, while if the input has 4.90000 then i need to see 4.90, and if input has 4.00000 then i need to see 4.00

    I have considered both input and output fields as Text and they are 8 char fixed length. Can any body please tell me how to solve this in WTX??

     

    Thanks,

    Rshya


    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 2.  Re: Decimal digits in WTX

    Posted 10/15/13 06:06 AM

    Originally posted by: thorstenhirsch


    Yes, I think going with a text field is a good decision here. I would also distinct between the whole number and the fraction, so let's give it a try:

    = WORD(input, '.', 1) // take whole number as it is

    + '.'

    // fraction is more complicate

    + FILLRIGHT(TRIMRIGHT(WORD(input, '.', 2), "0"), "0", 2)

    So we only remove '0' on the right side of the fraction (4.999 would still be 4.999) and then we fill the fraction up to 2 digits with '0' (4.9 becomes 4.90).

    P.S.: The WYSIWYG editor here is crappy.


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: Decimal digits in WTX

    Posted 10/15/13 10:05 AM

    Originally posted by: Rshya


    Thanks so much thorstenhirsch, it worked. but it is just that I had to put decimal point within double quotes and not single quotes and it worked. Thanks again!!

     

    Thanks,

    Rshya


    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 4.  Re: Decimal digits in WTX

    Posted 10/16/13 03:19 PM

    Originally posted by: Rshya


    Hi thorstenhirsch, I have a doubt here, when the input had 4.90000 it became 4.90, but when the the input had 4.00000, then it is showing only 4. and not 4.00.

    Couls you please tell me how to get 4.00 in this case??

     

    Thanks,

    Rshya


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: Decimal digits in WTX

    Posted 11/20/13 04:19 AM

    Originally posted by: Bhoju


    Try this.. i think it should work..

     

    if ( right(<youritem>, 2) = "00" & right(<youritem>, 2) != "000", // then
    numbertotext(truncate (texttonumber(<youritem>), 3))
    //else
    ,numbertotext(truncate (texttonumber(<youritem>), 2))
    )

    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender