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

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

Recommended Posts

Posted

I need to convert a field with numbers entered with multiple dashes to a number with no dashes. There are thousands of records. Is there a way to script this process? An example is 0-375-41616-1 to 0375416161. Some numbers have dashes in different places. Please help!

Mindy

Posted

use the substitute function, but test it out first so you know how it works. Basically you tell it Substitute(fieldname, searchchar, replacechar) so you would tell it to Substitute(fieldname, "-", ""). This is not the exact syntax, use the Cal function. You may have to run this more than once.

HTH

Old Advance Man

Posted

There is a quicker and better way to deal with this, because you don’t need a script:

Let’s say the field you want to convert is called NUM1

Create a second field called NUM2

Calculation: Text (make sure NUM1 is also set to text)

Substitute ( NUM1 , “-“ , “ “ )

Ok, now you have a field (NUM2), where (for example) 123-456-789 (in NUM1) is shown as:

123 456 789

Now simply set NUM2 from a calculation to a text field – FMP will give you a warning about losing data, but once you’ve converted, you’ll see that NUM2 has kept the values.

OK! Now simply convert NUM1 to a calculation field

= NUM2

Now you see that both fields are without the “-“

Now simply set NUM1 back to Text instead of a calculation (ignore the warning), and hey presto….. All the “-“ are gone. The beauty of this system is, that although it’s slow, it’s faster than a script, and should anything go wrong during the process, a recovery is much easier. It depends on how many records you have, which method is best. I prefere this, because with each step, you see the results before you have actually changed any stored data!

No disrespect meant “Old A Man” but one-time field conversions are (in my opinion) easier this way, than creating a script…… and faster

This topic is 8351 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.