Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6986 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Previously in FM5 I used a series of case statements to transform numbers to words for numbers up to 9999. Is there an easier way in FM7 with the Let function? I guess I'm a bit burned out today and hope that I don't have to reinvent the wheel, if someone has already done it. Thanks

Posted

Here's one that was a CF by Don Wieland. There are others around but some require CF because they use recursion. I'd just give you the link to it, but I can't find it now on Brian Dunning's site. I think this calc can be shortened quite a bit but I haven't had time.

Choose(Int(Mod(Dollars;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(Dollars;10^11) / 10^10) = 1; Choose(Int(Mod(Dollars;10^10) / 10^9); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(Dollars;10^11) / 10^10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")

&

Choose(Int(Mod(Dollars;10^10) / 10^9); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) &

Case(Int(Mod(Dollars;10^12)/10^9) and Int(Mod(Dollars;10^9) / 10^3); "Billion, "; Int(Mod(Dollars;10^12)/10^9);"Billion ";"")

& Choose(Int(Mod(Dollars;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(Dollars;10^8) / 10^7) = 1; Choose(Int(Mod(Dollars;10^7) / 10^6); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(Dollars;10^8) / 10^7); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")

& Choose(Int(Mod(Dollars;10^7) / 10^6); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Mod(Dollars;10^9)/10^6) and Int(Mod(Dollars;10^6) / 10^3); "Million, "; Int(Mod(Dollars;10^9)/10^6);"Million ";"")

& Choose(Int(Mod(Dollars;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(Dollars;10^5) / 10^4) = 1;

Choose(Int(Mod(Dollars;10^4) / 10^3); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod(Dollars;10^5) / 10^4); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &

Choose(Int(Mod(Dollars;10^4) / 10^3); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine "))

& Case(Int(Mod(Dollars;10^6)/10^3) and Int(Mod(Dollars;10^3) / 10^0); "Thousand, "; Int(Mod(Dollars;10^6)/10^3);"Thousand ";"")

& Choose(Int(Mod(Dollars;10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ")

&

If(Int(Mod(Dollars;100) / 10) = 1; Choose(Int(Mod(Dollars;10)); "Ten "; "Eleven "; "Twelve ";

"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Int(Mod(Dollars;100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod(Dollars;10)); ""; "One "; "Two "; "Three "; "Four

"; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int(Dollars) > 1; "Dollars"; Int(Dollars) = 1; "Dollar"; "")

& If(Mod(Dollars; 1) and Int(Dollars);" and ";"") &

If(Mod(Int(Dollars*10); 10) = 1; Choose(Mod(Int(Dollars*100); 10); "Ten "; "Eleven "; "Twelve ";

"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");

Choose(Mod(Int(Dollars*10); 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ")

& Choose(Mod(Int(Dollars*100); 10); ""; "One "; "Two "; "Three ";

"Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) &

Case(Mod(Dollars; 1) > .01; "cents"; Mod(Dollars; 1) = .01; "cent";"")

Posted

Thanks about 4 hours and 100 hair follicles worth, in other words, thanks a whole bunch.

(Things are things because of mind as mind is mind because of things. These two are merely relative and both at source are emptiness.)

This topic is 6986 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.