Ga naar inhoud
  • 0

cijfers to text


drjonesx

Vraag

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

Link naar reactie

12 antwoorden op deze vraag

Aanbevolen berichten

  • 0

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]

aangepast door Gast
Link naar reactie
  • 0

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 :P

Link naar reactie
  • 0

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

Link naar reactie
  • 0

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?

Link naar reactie
  • 0

:? 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 8O:D

Link naar reactie

Doe mee aan dit gesprek

Je kunt dit nu plaatsen en later registreren. Indien je reeds een account hebt, log dan nu in om het bericht te plaatsen met je account.

Gast
Beantwoord deze vraag...

×   Geplakt als verrijkte tekst.   Plak in plaats daarvan als platte tekst

  Er zijn maximaal 75 emoji toegestaan.

×   Je link werd automatisch ingevoegd.   Tonen als normale link

×   Je vorige inhoud werd hersteld.   Leeg de tekstverwerker

×   Je kunt afbeeldingen niet direct plakken. Upload of voeg afbeeldingen vanaf een URL in

×
×
  • Nieuwe aanmaken...