Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2011
    Posts
    176

    Unanswered: Numbers in words

    I have totalled one field for example say the total as 1250. I want to convert this 1250 in words like 'one thousand two hundred and fifty". Is there any possibility to do this automatically in Brilliant database through script?

  2. #2
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi
    Just tossing ideas around - not actually attempted this.
    For small numbers maybe a query/lookup table (hidden form with number/text conversion list) but for large numbers, I think you would have to break the number in to units, tens, hundreds etc and run looping scripts. Would be fairly involved to maintain "normal english" especially with the "teen" numbers and a lot of lines of "if scripts". Would like to play with this problem if other members do not have easy solution.
    Regards
    David

  3. #3
    Join Date
    Jul 2011
    Posts
    176
    Thank you David for your idea!

  4. #4
    Join Date
    Jul 2012
    Posts
    94
    Provided Answers: 4
    Try this one,

    Numbers to Text

  5. #5
    Join Date
    Jul 2011
    Posts
    176
    Thank you MacHeuS. Really wonderful idea!!

  6. #6
    Join Date
    Sep 2013
    Posts
    15

    Are you able to reconstruct the code?

    There is problem. For Example, 5000 is converted as "five thousand hundred and -" It should be only "five thousand"

  7. #7
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi
    Also try 5001 or any thousand number ending in single digit - not the expected result but possible only a little glitch in code and MacHeuS may know where to look.
    Regards
    David

  8. #8
    Join Date
    Jul 2012
    Posts
    94
    Provided Answers: 4
    It was from Brilliant Database examples.

    I tried to fix. I don't know how to read numbers in English very well. I hope it works now.
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2011
    Location
    Australia
    Posts
    264
    Provided Answers: 2
    Hi MacHeuS
    Had not noticed that example in BD site but downloaded direct off their site and it does show that thousand and one error. Sorry if I created extra work for you as I thought you may have had a hand in writing the script and might be familar with the code. Anyway big thank you as you have corrected that error in your version. While I don't need this function at moment, it is the type of thing that can come in handy in future.

    Regards
    David

  10. #10
    Join Date
    Sep 2013
    Posts
    15
    Thanks Macheus for all your efforts. Thank you once again...

  11. #11
    Join Date
    Sep 2013
    Posts
    15

    Request for editing the code...

    Hello Macheus...
    Your edited code works great. Unfortunately, I am not able to get underlying logic behind the code. As such not able to edit as per requirement. The change required is this: million and billion need to be replaced by lakh and crore.
    1 million = 10 lakh
    1 billion = 10 crore.
    Here are examples:

    100000 = One Lakh
    102003 = One Lakh Two Thousand Three
    112003 = One Lakh Twelve Thousand Three
    112782 = One Lakh Twelve Thousand Seven Hundred Eighty Two

    1000000 = Ten Lakh
    1002003 = Ten Lakh Two Thousand Three
    1112003 = Eleven Lakh Twelve Thousand Three
    1112782 = Eleven Lakh Twelve Thousand Seven Hundred Eighty Two

    10000000 = One Crore
    10002003 = One Crore Two Thousand Three
    11112003 = One Crore Eleven Lakh Twelve Thousand Three
    11112782 = One Crore Eleven Lakh Twelve Thousand Seven Hundred Eighty Two

    100000000 = Ten Crore
    100002003 = Ten Crore Two Thousand Three
    111112003 = Eleven Crore Eleven Lakh Twelve Thousand Three
    111112782 = Eleven Crore Eleven Lakh Twelve Thousand Seven Hundred Eighty Two

    I request you to modify the code if possible. Thanks.
    Don't need to covert numbers greater than 99 crore into words.

  12. #12
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It might help to read the Wikipedia article on how the Indian numbering System works. The shift from three digit groups to two digit groups is a bit of a challenge for people accustomed to the Arab system of always using three digit groups. Once you make the shift, it isn't too bad.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  13. #13
    Join Date
    Jul 2012
    Posts
    94
    Provided Answers: 4
    Check this.
    Attached Files Attached Files

  14. #14
    Join Date
    Sep 2013
    Posts
    15

    Thanks...

    It works
    Thanks Macheus for all your efforts and the valuable time that you have given for this. Looking for friendship with you...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •