dbTalk Databases Forums  

Building formulas

comp.databases.filemaker comp.databases.filemaker


Discuss Building formulas in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marion Gustin
 
Posts: n/a

Default Building formulas - 10-17-2004 , 03:33 PM






I wish to be able to enter numeric characters (eg: 567.00) into my
database and have them converted to text for printing.

I have a formula that only partially does this:
Choose(Int(Mod(Amount;10^6) / 10^5); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five-Hundred "; "Six-Hundred ";
"Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;10^5) / 10^4) = 1;
Choose(Int(Mod(Amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(Amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod(Amount;10^4) / 10^3); ""; "One-"; "Two- "; "Three- ";
"Four- "; "Five- "; "Six- "; "Seven- "; "Eigh-t "; "Nine- ")) &
Case(Int(Mod(Amount;10^6)/10^3) and Int(Mod(Amount;10^3) / 10^0);
"Thousand "; Int(Mod(Amount;10^6)/10^3);"Thousand ";"")
&
Choose(Int(Mod(Amount;10^3) / 100); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five- Hundred "; "Six-Hundred
"; "Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;100) / 10) = 1;
Choose(Int(Mod(Amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen ";
"Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen ";
"Nineteen ");
Choose(Int(Mod(Amount;100) / 10); ""; ""; "Twenty"; "Thirty"; "Forty";
"Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") &
Choose(Int(Mod(Amount;10));
"";"-One";"-Two";"-Three";"-Four";"-Five";"-Six";"-Seven";
"-Eight";"-Nine")) & Case(Int(Amount) > 1; "")
&
If(Mod(Amount; 1) and Int(Amount);" & ";"") &
If(Mod(Int(Amount*10); 10) = 1;
Choose(Mod(Int(Amount*100); 10); "10 "; "11"; "12"; "13"; "14 "; "15";
"16 "; "17 "; "18 "; "19 ");
Choose(Mod(Int(Amount*10); 10); ""; "1"; "2"; "3"; "4"; "5"; "6"; "7";
"8"; "9") &
Choose(Mod(Int(Amount*100); 10); ""; "1 "; "2 "; "3 "; "4 "; "5 "; "6
"; "7"; "8 "; "9 ")) &
Case(Mod(Amount ;1) > .01; "/100 - - - - - - - - - -"; Mod(Amount; 1)
= .01; "/100 - - - - - -";"")


It will convert correctly if the figure contains more than 0 cents,
but not if it is only .00

Does anyone have a formula that will do this or know how I might alter
this formula I have to replace ".00" with "No/100"?

Reply With Quote
  #2  
Old   
Paul
 
Posts: n/a

Default Re: Building formulas - 10-18-2004 , 09:04 AM






There is a TextToNumber External function plug-in that ships with developer.
It does it for you. See if you can get the plugin, it will save you time,
plus it has some other external functions built-in

Paul Zieper


"Marion Gustin" <mdhg (AT) tampabay (DOT) rr.com> wrote

Quote:
I wish to be able to enter numeric characters (eg: 567.00) into my
database and have them converted to text for printing.

I have a formula that only partially does this:
Choose(Int(Mod(Amount;10^6) / 10^5); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five-Hundred "; "Six-Hundred ";
"Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;10^5) / 10^4) = 1;
Choose(Int(Mod(Amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(Amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod(Amount;10^4) / 10^3); ""; "One-"; "Two- "; "Three- ";
"Four- "; "Five- "; "Six- "; "Seven- "; "Eigh-t "; "Nine- ")) &
Case(Int(Mod(Amount;10^6)/10^3) and Int(Mod(Amount;10^3) / 10^0);
"Thousand "; Int(Mod(Amount;10^6)/10^3);"Thousand ";"")
&
Choose(Int(Mod(Amount;10^3) / 100); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five- Hundred "; "Six-Hundred
"; "Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;100) / 10) = 1;
Choose(Int(Mod(Amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen ";
"Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen ";
"Nineteen ");
Choose(Int(Mod(Amount;100) / 10); ""; ""; "Twenty"; "Thirty"; "Forty";
"Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") &
Choose(Int(Mod(Amount;10));
"";"-One";"-Two";"-Three";"-Four";"-Five";"-Six";"-Seven";
"-Eight";"-Nine")) & Case(Int(Amount) > 1; "")
&
If(Mod(Amount; 1) and Int(Amount);" & ";"") &
If(Mod(Int(Amount*10); 10) = 1;
Choose(Mod(Int(Amount*100); 10); "10 "; "11"; "12"; "13"; "14 "; "15";
"16 "; "17 "; "18 "; "19 ");
Choose(Mod(Int(Amount*10); 10); ""; "1"; "2"; "3"; "4"; "5"; "6"; "7";
"8"; "9") &
Choose(Mod(Int(Amount*100); 10); ""; "1 "; "2 "; "3 "; "4 "; "5 "; "6
"; "7"; "8 "; "9 ")) &
Case(Mod(Amount ;1) > .01; "/100 - - - - - - - - - -"; Mod(Amount; 1)
= .01; "/100 - - - - - -";"")


It will convert correctly if the figure contains more than 0 cents,
but not if it is only .00

Does anyone have a formula that will do this or know how I might alter
this formula I have to replace ".00" with "No/100"?



Reply With Quote
  #3  
Old   
Paul Patenaude
 
Posts: n/a

Default Re: Building formulas - 10-18-2004 , 03:04 PM



Marion Gustin a écrit :
Quote:
I wish to be able to enter numeric characters (eg: 567.00) into my
database and have them converted to text for printing.

I have a formula that only partially does this:
Choose(Int(Mod(Amount;10^6) / 10^5); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five-Hundred "; "Six-Hundred ";
"Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;10^5) / 10^4) = 1;
Choose(Int(Mod(Amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(Amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod(Amount;10^4) / 10^3); ""; "One-"; "Two- "; "Three- ";
"Four- "; "Five- "; "Six- "; "Seven- "; "Eigh-t "; "Nine- ")) &
Case(Int(Mod(Amount;10^6)/10^3) and Int(Mod(Amount;10^3) / 10^0);
"Thousand "; Int(Mod(Amount;10^6)/10^3);"Thousand ";"")
&
Choose(Int(Mod(Amount;10^3) / 100); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five- Hundred "; "Six-Hundred
"; "Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;100) / 10) = 1;
Choose(Int(Mod(Amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen ";
"Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen ";
"Nineteen ");
Choose(Int(Mod(Amount;100) / 10); ""; ""; "Twenty"; "Thirty"; "Forty";
"Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") &
Choose(Int(Mod(Amount;10));
"";"-One";"-Two";"-Three";"-Four";"-Five";"-Six";"-Seven";
"-Eight";"-Nine")) & Case(Int(Amount) > 1; "")
&
If(Mod(Amount; 1) and Int(Amount);" & ";"") &
If(Mod(Int(Amount*10); 10) = 1;
Choose(Mod(Int(Amount*100); 10); "10 "; "11"; "12"; "13"; "14 "; "15";
"16 "; "17 "; "18 "; "19 ");
Choose(Mod(Int(Amount*10); 10); ""; "1"; "2"; "3"; "4"; "5"; "6"; "7";
"8"; "9") &
Choose(Mod(Int(Amount*100); 10); ""; "1 "; "2 "; "3 "; "4 "; "5 "; "6
"; "7"; "8 "; "9 ")) &
Case(Mod(Amount ;1) > .01; "/100 - - - - - - - - - -"; Mod(Amount; 1)
= .01; "/100 - - - - - -";"")


It will convert correctly if the figure contains more than 0 cents,
but not if it is only .00

Does anyone have a formula that will do this or know how I might alter
this formula I have to replace ".00" with "No/100"?
The function "mod" in math is defined to operate only on integer not decimals...
If it might help...


Reply With Quote
  #4  
Old   
G.Miller
 
Posts: n/a

Default Re: Building formulas - 10-18-2004 , 03:54 PM



"Marion Gustin" wrote:

Quote:
I wish to be able to enter numeric characters (eg: 567.00) into my
database and have them converted to text for printing.

I have a formula that only partially does this:
Choose(Int(Mod(Amount;10^6) / 10^5); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five-Hundred "; "Six-Hundred ";
"Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;10^5) / 10^4) = 1;
Choose(Int(Mod(Amount;10^4) / 10^3); "Ten "; "Eleven "; "Twelve ";
"Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen ";
"Eighteen "; "Nineteen ");
Choose(Int(Mod(Amount;10^5) / 10^4); ""; ""; "Twenty "; "Thirty ";
"Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod(Amount;10^4) / 10^3); ""; "One-"; "Two- "; "Three- ";
"Four- "; "Five- "; "Six- "; "Seven- "; "Eigh-t "; "Nine- ")) &
Case(Int(Mod(Amount;10^6)/10^3) and Int(Mod(Amount;10^3) / 10^0);
"Thousand "; Int(Mod(Amount;10^6)/10^3);"Thousand ";"")
&
Choose(Int(Mod(Amount;10^3) / 100); ""; "One-Hundred "; "Two-Hundred
"; "Three-Hundred "; "Four-Hundred "; "Five- Hundred "; "Six-Hundred
"; "Seven-Hundred "; "Eight-Hundred "; "Nine-Hundred ") &
If(Int(Mod(Amount;100) / 10) = 1;
Choose(Int(Mod(Amount;10)); "Ten "; "Eleven "; "Twelve "; "Thirteen ";
"Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen ";
"Nineteen ");
Choose(Int(Mod(Amount;100) / 10); ""; ""; "Twenty"; "Thirty"; "Forty";
"Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") &
Choose(Int(Mod(Amount;10));
"";"-One";"-Two";"-Three";"-Four";"-Five";"-Six";"-Seven";
"-Eight";"-Nine")) & Case(Int(Amount) > 1; "")
&
If(Mod(Amount; 1) and Int(Amount);" & ";"") &
If(Mod(Int(Amount*10); 10) = 1;
Choose(Mod(Int(Amount*100); 10); "10 "; "11"; "12"; "13"; "14 "; "15";
"16 "; "17 "; "18 "; "19 ");
Choose(Mod(Int(Amount*10); 10); ""; "1"; "2"; "3"; "4"; "5"; "6"; "7";
"8"; "9") &
Choose(Mod(Int(Amount*100); 10); ""; "1 "; "2 "; "3 "; "4 "; "5 "; "6
"; "7"; "8 "; "9 ")) &
Case(Mod(Amount ;1) > .01; "/100 - - - - - - - - - -"; Mod(Amount; 1)
= .01; "/100 - - - - - -";"")


It will convert correctly if the figure contains more than 0 cents,
but not if it is only .00

Does anyone have a formula that will do this or know how I might alter
this formula I have to replace ".00" with "No/100"?
How about a specific test for that instance?

If truncate(Amount,0) = Amount then set text to "No/100"

I would insert this in the necessary place but trying to decipher any
formula but my own makes my head spin!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.