Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONVERT NUMERIC TO ALPHABETICAL

Status
Not open for further replies.

jorgis

Programmer
Jun 26, 2005
3
BE
Hey,

I work with Crystal 8.0 and I have to convert a numbre to text.

eg : Total amount = 520,20 €

--> result must be :

five two zero komma two zero

is this possible?

thanks for helping me !
jm
 
Is posible, just create an function array/case that read the expression, Something like
Expression i;
NumberVar n;
Len(1,000.00) = n;


for n = 1 to n

select case (NUM CHARACTER)

case "1"
Expression := Expression & " ONE "


etc.....
 
Well the comma is the tricky part.

A formula such as:

whileprintingrecords;
stringvar Output:="";
numbervar letters;
for Letters := 1 to len(trim(totext({table.field},2,""))) do(
if isnumeric(mid({table.field,letters,1)) then
Output:=Output & towords(val(mid({table.field,letters,1)))+" "
else
if mid({table.field,letters,1) = "," then
Output:=Output & "Komma "
0;
Output

Should get you close.

-k
 
There is some extra tricky part that I forgot.

Total amount = 520,20 €

it isn't five two zero komma two zero, but it has to be Five Hundred twenty komma twenty euro

is that possible???

jm
 
OK, try this then:

towords(val(split("520,20",",")[1]),0) & " Komma " & towords(val(split("520,20",",")[2]),0) & " Euros"

Replace the "520,20" with your field.

-k
 
Wait, if it's a numeric use:

towords(val(split(totext({table.field,0,""),",")[1]),0) & " Komma " & towords(val(split(totext(table.field,0,""),",")[2]),0) & " Euros"

-k
 
Tomorrow I try this in a special doc. at the office. If it doesn't work, I let you know.

bye and thanks

jm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top