Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

converting the data inside the text field


This topic is 4119 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi everyone please help me i have a text field containing "my 18th birthday" i want this to convert in "my eighteenth birthday" thank you  :yep:

 

Posted

How high in numbers do you want to take this. i.e. teens, 20s 30s 100s, etc.?

 

You can use the Substitute Function as long as you don't go too high, say the first 20 numbers.

 

Above that, you would need a modification of the calculation at FMI (linked above). I feel that as Entry Level user, someone with experience would probably need to assist you in that?

 

Here is a demo file showing the two calculations and their results.

chadski021.fmp12.zip

Posted

Thank you  doughemi and Lee Smith for the reply :)

 

I created a new field named CCconvert for the conversion of the number i used this calculation:

 

CCname(text field) :: "my 18th birthday"

 

"Choose(Int(Mod(GetAsNumber(CCname);10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") &

If(Int(Mod((GetAsNumber(CCname);100) / 10) = 1;
Choose(Int(Mod((GetAsNumber(CCname);10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");
Choose(Int(Mod((GetAsNumber(CCname);100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod((GetAsNumber(CCname);10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int((GetAsNumber(CCname)) > 1; ""; Int((GetAsNumber(CCname)) = 1; ""; "")
 
When i used this calculation the result in CCconvert field only show  "Eighteen".
My question is how can i show the text "my Eighteenth birthday"? Do i need to create a new field to show this?
 
Thank you.
Posted

CCconvert =

 

let([

bigHairyCalc = Choose(Int(Mod(GetAsNumber(CCname);10^3) / 100); ""; "One Hundred "; "Two Hundred "; "Three Hundred "; "Four Hundred "; "Five Hundred "; "Six Hundred "; "Seven Hundred "; "Eight Hundred "; "Nine Hundred ") &

If(Int(Mod((GetAsNumber(CCname);100) / 10) = 1;
Choose(Int(Mod((GetAsNumber(CCname);10)); "Ten "; "Eleven "; "Twelve "; "Thirteen "; "Fourteen "; "Fifteen "; "Sixteen "; "Seventeen "; "Eighteen "; "Nineteen ");
Choose(Int(Mod((GetAsNumber(CCname);100) / 10); ""; ""; "Twenty "; "Thirty "; "Forty "; "Fifty "; "Sixty "; "Seventy "; "Eighty "; "Ninety ") &
Choose(Int(Mod((GetAsNumber(CCname);10)); ""; "One "; "Two "; "Three "; "Four "; "Five "; "Six "; "Seven "; "Eight "; "Nine ")) & Case(Int((GetAsNumber(CCname)) > 1; ""; Int((GetAsNumber(CCname)) = 1; ""; "")];
Substitute(CCname; GetAsNumber(CCname); bigHairyCalc)// <--this is how you get the calc into the text
)
 
Note that this calc will fail if the number ends in 1, 2, or 3 -- 22nd will return "twenty-twond" instead of "twenty-second".  Lee's example is relevant, and a table of all desired numbers with the exceptions declared literally and the rest calculated may be the answer depending on the range you need.  Perhaps it's time you shared in what context this is going to be used.
  • 2 weeks later...
Posted

Hello Doughemi

 

the number im converting is base on the address number 

i think the number range is between 1-1000th is there a easy one to convert the numbers accurately 

  • 2 weeks later...
Posted

Hello doughemi im using the same calculation in database but its not producing any inputs i used also

onobject exit

Posted

Since you have 12 Advanced, use the Script Debugger (Tools->Script Debugger) to step through the script to see if variables and fields are set or not.

This topic is 4119 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.