Jump to content

Remove a character from the text of a field?


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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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