July 16, 201312 yr Hi everyone please help me i have a text field containing "my 18th birthday" i want this to convert in "my eighteenth birthday" thank you
July 16, 201312 yr How about http://help.filemaker.com/app/answers/detail/a_id/2860/~/converting-numbers-to-words-or-numbers-to-text First you have to strip the numbers out of the text. GetAsNumber(YourTextField) will help, but will fail if you have a text such as "My 18th birthday was the number 1 party of all time."
July 16, 201312 yr How high in numbers do you want to take this. i.e. teens, 20s 30s 100s, etc.? You can use the Substitute Function as long as you don't go too high, say the first 20 numbers. Above that, you would need a modification of the calculation at FMI (linked above). I feel that as Entry Level user, someone with experience would probably need to assist you in that? Here is a demo file showing the two calculations and their results. chadski021.fmp12.zip
July 17, 201312 yr Author Thank you doughemi and Lee Smith for the reply I created a new field named CCconvert for the conversion of the number i used this calculation: CCname(text field) :: "my 18th birthday" "Choose(Int(Mod(GetAsNumber(CCname);10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod((GetAsNumber(CCname);100) / 10) = 1; Choose(Int(Mod((GetAsNumber(CCname);10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod((GetAsNumber(CCname);100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod((GetAsNumber(CCname);10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int((GetAsNumber(CCname)) > 1; ""; Int((GetAsNumber(CCname)) = 1; ""; "") When i used this calculation the result in CCconvert field only show "Eighteen". My question is how can i show the text "my Eighteenth birthday"? Do i need to create a new field to show this? Thank you.
July 17, 201312 yr CCconvert = let([ bigHairyCalc = Choose(Int(Mod(GetAsNumber(CCname);10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") & If(Int(Mod((GetAsNumber(CCname);100) / 10) = 1; Choose(Int(Mod((GetAsNumber(CCname);10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen "); Choose(Int(Mod((GetAsNumber(CCname);100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") & Choose(Int(Mod((GetAsNumber(CCname);10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int((GetAsNumber(CCname)) > 1; ""; Int((GetAsNumber(CCname)) = 1; ""; "")]; Substitute(CCname; GetAsNumber(CCname); bigHairyCalc)// <--this is how you get the calc into the text ) Note that this calc will fail if the number ends in 1, 2, or 3 -- 22nd will return "twenty-twond" instead of "twenty-second". Lee's example is relevant, and a table of all desired numbers with the exceptions declared literally and the rest calculated may be the answer depending on the range you need. Perhaps it's time you shared in what context this is going to be used.
August 1, 201312 yr Author Hello Doughemi the number im converting is base on the address number i think the number range is between 1-1000th is there a easy one to convert the numbers accurately
August 15, 201312 yr Author Hello doughemi im using the same calculation in database but its not producing any inputs i used also onobject exit
August 15, 201312 yr Since you have 12 Advanced, use the Script Debugger (Tools->Script Debugger) to step through the script to see if variables and fields are set or not.
Create an account or sign in to comment