June 9, 200619 yr Name & Parameters: [color:red][big] AmountText ( amount ) [/big] Description: Not quite mine, just adapted from a formula posted on the FMP website. Returns the check-style text line given a dollar amount in a number field referenced by the "amount" parameter. As posted, only works with US Currency, but I'm sure it can be modified for anything. Sample Input: 123.45 Results: One Hundred Twenty Three Dollars and Forty Five cents Recursive: no Formula: Choose(Int(Mod(amount;10^12) / 10^11); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod(amount;10^11) / 10^10) = 1; Choose(Int(Mod(amount;10^10) / 10^9); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(amount;10^11) / 10^10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(amount;10^10) / 10^9); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(amount;10^12)/10^9) and Int(Mod(amount;10^9) / 10^3); "Billion, "; Int(Mod(amount;10^12)/10^9);"Billion ";"") & Choose(Int(Mod(amount;10^9) / 10^8); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod(amount;10^8) / 10^7) = 1; Choose(Int(Mod(amount;10^7) / 10^6); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(amount;10^8) / 10^7); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(amount;10^7) / 10^6); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(amount;10^9)/10^6) and Int(Mod(amount;10^6) / 10^3); "Million, "; Int(Mod(amount;10^9)/10^6);"Million ";"") & Choose(Int(Mod(amount;10^6) / 10^5); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod(amount;10^5) / 10^4) = 1; Choose(Int(Mod(amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(amount;10^4) / 10^3); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(amount;10^6)/10^3) and Int(Mod(amount;10^3) / 10^0); "Thousand, "; Int(Mod(amount;10^6)/10^3);"Thousand ";"") & Choose(Int(Mod(amount;10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod(amount;100) / 10) = 1; Choose(Int(Mod(amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(amount;100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(amount;10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(amount) > 1; "Dollars"; Int(amount) = 1; "Dollar"; "") & If(Mod(amount; 1) and Int(amount);" and ";"") & If(Mod(Int(amount*10); 10) = 1; Choose(Mod(Int(amount*100); 10); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Mod(Int(amount*10); 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Mod(Int(amount*100); 10); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Mod(amount; 1) > .01; "cents"; Mod(amount; 1) = .01; "cent";"") Required Functions: Author(s) mx4px Date: 06/09/06 Credits: www.filemaker.com & Andy Frazier Disclaimer: FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify. AmountTextSample.zip
June 12, 200619 yr Newbies Thanks for this! You are a life saver!!! I had an idea of how I wanted to write it, but was not looking forward to figuring it all out. Thanks!!!
August 15, 200718 yr Author Genx, the cf you referenced from Brian's site accomplishes something different...that one will take 123.45 and give you "US$123.45." Mine will take 123.45 and give you "one hundred twenty three dollars and forty-five cents". The point of mine is to give you the amount in WORDS, like you'd see in the text area of a check.
August 15, 200718 yr The technique has been around for a long time. I just did a search for Numbers to Text, and found this Link There is a file I pointed to, and a CF that Mr. Vodka pointed to. HTH Lee
August 18, 200718 yr Author Naturally, Mr. Smith - there is nothing new under the sun!! Also, as I mentioned, the "technique" wasn't mine...it was FMI's; I just modified it slightly to make it available as a CF in case someone needed it that way. The function you referenced (http://www.briandunning.com/cf/22) is indeed something I hadn't seen - but then again it was posted a month after I posted this. Plus it requires two other functions - this one's self-contained. Like all things free, though - use it if you like, don't if you don't!! 'Nuff said.
August 18, 200718 yr The function you referenced (http://www.briandunning.com/cf/22) is indeed something I hadn't seen - but then again it was posted a month after I posted this. Well thats pretty strange considering that I posted the link to that CF on Wed Nov 09 2005 01:24 PM . Hehe... :
August 18, 200718 yr Author Sorry, Mr. Vodka. Just looked at it and it said it was updated in July of '06. Didn't mean to steal your thunder!
August 18, 200718 yr Nah not stealing any thunder... I was just teasing you. It always helps to have different methods to solve the same problem. :
Create an account or sign in to comment