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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number toword

Status
Not open for further replies.

idehen

Technical User
Oct 26, 2004
92
0
0
GB
Hi All,

I am using CR 2008 and i want to convert number to word.

Number is 39.4030 and i used a

formula 1: called this "Convert units to word"

ToWords(truncate({@Units to Sell},0),0)+" point "+ToWords(Val(Right(totext({@Units to Sell}),2)),0)

Then Formula 2: called this "Display"

whileprintingrecords;
stringvar array x;
redim preserve x[ubound(x)+1];
numbervar counter := 0;
stringvar result := "";

x := split({@Convert units to words}," ");
for counter := 1 to ubound(x) do(
result := result + ucase(left(x[counter],1))+mid(x[counter],2) + " ");
replace(result,"And","and");

Result:
Showing as Thirty-nine point Forty

Expected result should be:
Thirty-nine Point Forty and Thirty

I can't get this to show the thirty (30). Can someone please help.

Much appreciated.

Sol
 
Thanks LB

Appreciate the help. For now the decimals displayed (for my calc) is 2dp, but glad you gave the example for 4dp as well as both logic are very handy.

Much appreciated.
Sol
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top