locked
number to words in crystal report RRS feed

  • Question

  • good evening to all =) ahmm.. im having a small problem printing out the data....where the value has a decimal....

     

    ahmm actually its currency... =) where the currency is worth something like $23,544.18  ... what i want is it will give an output of twenty-three thousand five hundred forty-four and eighteen centavos 

    what im using now do display the number to word is 

    ProperCase(Towords({tbl_assessment.Amount}))

    ...thanks in advance sir...

     


    Tuesday, July 19, 2011 12:17 PM

All replies

  • first convert only the integer part of the amount to words and then convert the decimal part to integer and pass it to to words and concatenate these two together

    --------------------------------------------------------

    Surender Singh Bhadauria

     


    Tuesday, July 19, 2011 12:48 PM
  • Hello,

    Here's info from a post I did on SAP Crystal Reports forums, simply replace the values with your field:


    Towords(truncate(8900.89), 0) + " and " + towords(abs(100 * (truncate(8900.89)- 8900.89)), 0) + " centavos";

    result is: eight thousand nine hundred and eighty-nine centavos

    Why:
    Towords(truncate(8900.89), 0) returns 8900, the "," 0 tells the function to ignore the decimal place.

    (abs(100 * (8900.89 - truncate(8900.89)) abs converts it to a positive value always just in case and multiplies the value to be non decimal.

    If you have more decimal places you'll have to adjust the 100 multiplier

    Thank you
    Don


    Don Williams
    Tuesday, July 19, 2011 1:08 PM