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

TOWORD EXCEPTION 3

Status
Not open for further replies.

mafercita

Technical User
Jan 16, 2006
9
MX
DURANGO 122
HOW CAN I MAKE THAT THE FORMULA TOWORD THAT THROW ME FOR EXAMPLE $101 (ONE HUNDRED 00/1OO) REPLACE IT WITH (ONE HUNDRED DOLAR 00/100) IS THIS POSSIBLE?
 
You might try:

whileprintingrecords;
numbervar counter;
Stringvar output:="";
stringvar MyWord:=toword({table.field});
For counter := 1 to len(MyWord) do(
if isnumeric(mid(MyWord,counter,1)) then
output:=Output + " dollars " & mid(myword,counter,1);
else
output:=Output + mid(myword,counter,1);
);
output

-k
 
SORRY YOUU´RE GOING TO HATE ME BUT THE FORMULA MAKES THIS:
58.11 (FIFTY EIGHT DOLLARS 1 DOLLAR 1 DOLLAR/1 DOLLAR O DOLLARS 0 DOLLARS...
WHY?
 
Ooops, sorry, try:

whileprintingrecords;
numbervar counter;
Boolean AddDollars:=True;
Stringvar output:="";
stringvar MyWord:=toword({table.field});
For counter := 1 to len(MyWord) do(
if isnumeric(mid(MyWord,counter,1))
and
NoDollars then
(
NoDollars:=False;
output:=Output + " dollars " & mid(myword,counter,1);
else
output:=Output + mid(myword,counter,1);
);
output

-k
 
Another approach would be to use:

towords(truncate({table.amt}),0) + " dollars and " +
totext(remainder({table.amt},truncate({table.amt}))*100,0)+"/100 cents"

You can remove the "and" and the "cents" if you don't want them.

-LB
 
PS--Please don't post in capital letters--it is hard to read and generally interpreted as yelling!

-LB
 
Maybe I'm missing something, but it seems that Business Objects made it harder than necessary.

-LB
 
durango 122:
sorry but I'm desesperate...this formula make a mistake..it tell`s me that is missing a ( before the word else...what´s wrong..
WhilePrintingRecords;
numbervar counter;
Stringvar output:="";
Booleanvar AddDollars:=True;
stringvar MyWord:=towordS({Empleados.Salario});
For counter := 1 to len(MyWord)
do(
if isnumeric(mid(MyWord,counter,1))and addDollars then
addDollars:=False;
output:=(Output + " dollars " + mid(myword,counter,1)
else output:=Output + mid(myword,counter,1);
)

output
 
SORRY DURANGO 122 I HAVEN´T SEEN THIS SOLUTION
towords(truncate({table.amt}),0) + " dollars and " +
totext(remainder({table.amt},truncate({table.amt}))*100,0)+"/100 cents"

I PUT IT ON THE REPORT AND WORKS PERFECTLY..THANKS A LOT....THANKS!!!!!!!!!!!!!!!!!!!!!1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top