accuraterealty Posted February 13, 2008 Posted February 13, 2008 in my database, I have 2 fields. 1 is a number, and the other a calc. Lets say in the number field i enter 21. In the calc. field, it will say "twenty one dollars". But if I enter in 100. It will say "one hundred and dollars". I am trying to get it to say "one hundred dollars" , or maybe even "One hundred and zero dollars" The Calc. I am using is below, NumberField is the field it is reading the numbers from. Any help? Choose(Int(Mod(NumberField;10^12) / 10^11); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & Case(Int(Mod(NumberField;10^12) / 10^11)and Int(Mod(NumberField;10^10) / 10^9)>0>0;"and ";"") & If(Int(Mod(NumberField;10^11) / 10^10) = 1; Choose(Int(Mod(NumberField;10^10) / 10^9); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(NumberField;10^11) / 10^10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(NumberField;10^10) / 10^9); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(NumberField;10^12)/10^9) and Int(Mod(NumberField;10^9) / 10^3); "Billion, "; Int(Mod(NumberField;10^12)/10^9);"Billion ";"") & Choose(Int(Mod(NumberField;10^9) / 10^8); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") // & Case(Int(Mod(NumberField;10^9) / 10^8)>0 and Int(Mod(NumberField;10^8) / 10^7)>0;"and ";"") // & If(Int(Mod(NumberField;10^8) / 10^7) = 1; Choose(Int(Mod(NumberField;10^7) / 10^6); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(NumberField;10^8) / 10^7); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(NumberField;10^7) / 10^6); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(NumberField;10^9)/10^6) and Int(Mod(NumberField;10^6) / 10^3); "Million, "; Int(Mod(NumberField;10^9)/10^6);"Million ";"") & Choose(Int(Mod(NumberField;10^6) / 10^5); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") // & Case(Int(Mod(NumberField;10^6) / 10^5)>0 and Int(Mod(NumberField;10^5) / 10^4)>0;"and ";"") // & If(Int(Mod(NumberField;10^5) / 10^4) = 1; Choose(Int(Mod(NumberField;10^4) / 10^3); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(NumberField;10^5) / 10^4); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(NumberField;10^4) / 10^3); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & // Case(Int(Mod(NumberField;10^6)/10^3) and Int(Mod(NumberField;10^3) /10^0); "Thousand" & Case(Int(Mod(NumberField;10^3) / 100)=0;" and ";", "); Int(Mod(NumberField;10^6)/10^3);"Thousand ";"") // & Choose(Int(Mod(NumberField;10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & Case(Int(Mod(NumberField;10^3) / 100)>0 and Int(NumberField / 10)>0;"and ";"") & If(Int(Mod(NumberField;100) / 10) = 1; Choose(Int(Mod(NumberField;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(NumberField;100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(NumberField;10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(NumberField) > 1; "Dollars"; Int(NumberField) = 1; "Dollar"; "") & If(Mod(NumberField; 1) and Int(NumberField);" and ";"") & If(Mod(Int(NumberField*10); 10) = 1; Choose(Mod(Int(NumberField*100); 10); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Mod(Int(NumberField*10); 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Mod(Int(NumberField*100); 10); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Mod(NumberField; 1) > .01; "cents"; Mod(NumberField; 1) = .01; "cent";"")
comment Posted February 13, 2008 Posted February 13, 2008 See if this helps: http://www.fmforums.com/forum/showtopic.php?tid/112852/tp/0/all/1/
Fitch Posted February 13, 2008 Posted February 13, 2008 Search the Custom Functions for "Currency" or "Money."
Lee Smith Posted February 13, 2008 Posted February 13, 2008 Hi Tom, They are using the Standard Edition of v9. There is a file with a CF by The Shadow post to the thread comment pointed to. Lee :
Fitch Posted February 14, 2008 Posted February 14, 2008 Good point, Lee. It's true that you can't actually create custom functions without FileMaker Advanced. However, I don't think any of the CFs for number-to-word that you'll find on the site I linked are recursive. I.e. you can easily modify them to use in a normal (non CF) calculation, FM Advanced not required.
comment Posted February 14, 2008 Posted February 14, 2008 I don't think any of the CFs for number-to-word that you'll find on the site I linked are recursive. At least some of them are. But the real question is whether they are any good. :eeek:
pjdodd Posted April 8, 2008 Posted April 8, 2008 Case(NumberIn = 0; ""; Let ( [FullNumber = GetAsNumber(numberin); Number = Int(FullNumber); len = Int(Log(Number)) + 1] ; Case(len > 15; "Out of Range"; Currency = "EvalOnly"; Let([Hundred = Left(number; 1); TensOnes = Right(number; 2); TONum = GetAsNumber(TensOnes); Tens = Left(TensOnes; 1); Ones=If(TONum < 20; TensOnes; Right(TensOnes; 1))]; Case(len = 3; Choose(hundred; ""; "One"; "Two"; "Three"; "Four "; "Five"; "Six"; "Seven"; "Eight"; "Nine") & " Hundred" & Case(TONum≠0;" ")) & Case(TONum > 19; Choose(tens; ""; ""; "Twenty"; "Thirty"; "Forty"; "Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") & Case(Ones ≠ 0; " ")) & Choose(ones; ""; "One"; "Two"; "Three"; "Four "; "Five"; "Six"; "Seven"; "Eight"; "Nine"; "Ten"; "Eleven"; "Twelve"; "Thirteen"; "Fourteen"; "Fifteen"; "Sixteen"; "Seventeen"; "Eighteen"; "Nineteen") ); If(len >3; Let([useLeft = Choose(Mod(len; 3);3; 1; 2); NewLen= 10 ^ (len - UseLeft); ThisValue = Div(number; NewLen); NewValue = Number - ThisValue * NewLen]; NumberInWords(ThisValue; "EvalOnly"; "None") & " " & Choose(Div(len - 1; 3); ""; "Thousand"; "Million"; "Billion"; "Trillion" ) & Case(NewValue ≠ 0;" " & NumberInWords(NewValue; ""; "None"))); NumberInWords(Number; "EvalOnly"; "None")) & Case(currency ≠ ""; " " & Currency) & Case(DecimalCurr ≠ "None"; " and " & Let([Decimal = Int(100 * (fullnumber - number))]; If(Decimal = 0; "Zero"; NumberInWords(Decimal; "EvalOnly"; "None"))) & " " & DecimalCurr)))) I found this on here, somewhere...
Recommended Posts
This topic is 6133 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now