drjonesx Posted June 17, 2015 Posted June 17, 2015 Hello everybody I'm trying to convert number to text in dutch but it doesn't work i had some problem with the calc field when i m trying ( some are good but other doesn't work) is there someone that can help me to resolve this little problem cose i m not a dutch person Or there is a example file already done? In advance thanks u here is my email in case of drjonesx@belcenter.com Quote
0 menno Posted June 18, 2015 Posted June 18, 2015 (edited) Try this custom function: NumberAsText ( number ; i ) The code of the CF: If ( GetAsNumber ( number ) < 10^66 ; Let ( [ number = Filter( number ; "0123456789" ) ; Nr = Right ( number ; 3 ) ; n = Left ( number ; Length ( number ) - 3 ) ; L = Length ( Nr ) ; h = If ( L = 3 ; GetAsNumber ( Middle ( Nr ; L - 2 ; 1 ) ) ) ; // Hundreds t = If ( L > 1 ; GetAsNumber ( Middle ( Nr ; L - 1 ; 1 ) ) ) ; // Tens d = If ( L > 1 ; GetAsNumber ( Right ( Nr ; 2 ) ) ) ; // Doubles s = GetAsNumber ( Right ( Nr ; 1 ) ) ; // Singles th = Choose ( h ; "" ; "één" ; "twee" ; "drie" ; "vier" ; "vijf" ; "zes" ; "zeven" ; "acht" ; "negen" ) & "honderd" ; tt = Choose ( t ; "" ; "tien" ; "twintig" ; "dertig" ; "veertig" ; "vijftig" ; "zestig" ; "zeventig" ; "tachtig" ; "negentig" ) ; td = Choose ( d ; "" ; "één" ; "twee" ; "drie" ; "vier" ; "vijf" ; "zes" ; "zeven" ; "acht" ; "negen" ; "tien" ; "elf" ; "twaalf" ; "dertien" ; "veertien" ; "vijftien" ; "zestien" ; "zeventien" ; "achttien" ; "negentien" ) ; ts = Choose ( s ; "nul" ; "één" ; "twee" ; "drie" ; "vier" ; "vijf" ; "zes" ; "zeven" ; "acht" ; "negen" ) ; p = Choose ( i ; "" ; "duizend" ; "miljoen" ; "miljard" ; "biljoen" ; "biljard" ; "triljoen" ; "triljard" ; "quadriljoen" ; "quadriljard" ; "quintiljoen" ; "quintiljard" ; "sexiljoen" ; "sexiljard" ; "septiljoen" ; "septiljard" ; "octiljoen" ; "octiljard" ; "noniljoen" ; "noniljard" ; "deciljoen" ; "deciljard" ) ; txt = If ( h > 0 ; th ) & If ( d ≥ 20 and s > 0 ; If ( h > 0 ; "en" ) & ts & If ( d > 20 ; "en" ) ) & If ( d ≥ 20 ; tt ) & If ( d < 20 ; If ( h > 0 and d > 0 or n > 0 and L = 2 ; "en" ) & td ) & If ( L = 1 ; ts ) & p ] ; If ( n > 0 ; NumberAsText ( n ; i + 1 ) ) & txt ) ; " ≥ 10^66 " ) [edit]Added a tweak to calculation of the doubles and corrected "achttien" in the "td" variable[/edit] Edited June 20, 2015 by Guest Quote
0 drjonesx Posted June 18, 2015 Author Posted June 18, 2015 Thank u menno Sorry but i haven't filemaker dev so i can't access to the personnal fonction is there a way to have it for a "normal" version? Btw thanks alot for sharing with me this formula Quote
0 menno Posted June 18, 2015 Posted June 18, 2015 You can write a script that does the same thing. See the example NumToText.fmp12 Quote
0 drjonesx Posted June 18, 2015 Author Posted June 18, 2015 U right but the idea was to make an calcul field that was more easy that to past from an script i really appricaite your help for this problem Hope u can help in just a calcul field that give the result Thanks a lot for your precious help Quote
0 menno Posted June 18, 2015 Posted June 18, 2015 Either the CF or the script would really be the eassiest way. You probably need this calc to create cheques or certificates of some kind. If you absolutely need a calc, then you should break the CF down and start repeating all of the content up to 22 times, into a flat non-recursive function, but that would be very hard to edit or debug .... Better use the script, in the way I wrote it, it's easy to use for other fields as well. Good luck Quote
0 drjonesx Posted June 19, 2015 Author Posted June 19, 2015 Thank u for your help A friend set me the CF in the file but it seems to have a mistake when i set with the script file 153.51 i receive TEXT : vijftienduizenddriehonderdenvijftien resultat : driehonderdenvijftien with the CF vijftienduizenddriehonderdenéénenvijftig And the result need to be that no? honderd drieenvijftig euro en eenenvijftig cent Because i don't speak dutch very hard for me to resolv it Thanks for your time Menno Quote
0 menno Posted June 19, 2015 Posted June 19, 2015 The formula i made is for integers only, so you should use it twice: Once for the integer and the create an integer for the fraction and use it again, so it would something like: NumToText ( 153 ; "" ) & " euro en " NumToText ( 51 ; "" ) I assume that you know how to disect a number into 2 integers? Quote
0 drjonesx Posted June 19, 2015 Author Posted June 19, 2015 nop Menno, i don't. It's a point over my competences Sorry i hope it s not gonna block u to help me to resolve this calculation problem Quote
0 menno Posted June 19, 2015 Posted June 19, 2015 Try: Let ( [ n1 = int ( number ) ; n2 = Right ( 100 * number ; 2 ) ; t1 = NumberAsText ( n1 ) ; t2 = If ( GetAsNumber ( n2 ) > 0 ; NumberAsText ( n2 ) ; "nul" ) ] ; t1 & " euro en " & t2 & " cent" ) Most of this is math, a bit of logical reasoning and a tiny little bit FileMaker Quote
0 drjonesx Posted June 20, 2015 Author Posted June 20, 2015 Thanks Menno U MADE MY DAY one more time thanks for your time sharing your knowledge Quote
0 menno Posted June 20, 2015 Posted June 20, 2015 In total it maybe took about an hour of my time and I can use this function for my own projects, so you're welcome Right now I am translating this function in english, french and german, to publish it on my blog Quote
0 andries Posted June 21, 2015 Posted June 21, 2015 hi menno, just another way to split a number into the integer and decimal part Let ( [ _x = -232,20102; _int = Int ( _x ); _dec = Abs ( _x - _int ) ]; _dec ) Quote
Question
drjonesx
Hello everybody
I'm trying to convert number to text in dutch but it doesn't work
i had some problem with the calc field when i m trying ( some are good but other doesn't work)
is there someone that can help me to resolve this little problem cose i m not a dutch person
Or there is a example file already done?
In advance thanks u
here is my email in case of
drjonesx@belcenter.com
12 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.