How to trim right trailing space in Filemaker Pro

Hi All,

I have around 400 records in FileMaker Pro 9 with some fields that have extra trailing space.

How do I remove them?
I added  the following trim calculation to the field:
But it didnt remove any trailing space.
Thanks for any help.

Who is Participating?
webwyzsystems, what I said was "The filter() function is useful for removing non-standard characters from a string." My example filter() actually did include the space character.

My example was specifically addressing the case where there are non-standard characters that need to be trimmed.

If the problem is simply to remove trailing spaces without affecting spaces between words, then the trim() function is all you need.

how did you do this exactly? using the auto-enter feature? did you enable replacement of existing values?
or in a script?
maybe these invisibles characters are not spaces?
I would select the field that I wanted to remove the trailing spaces from and select the replace contents menu selection then in the calculation I would put Trim(Fieldname you are trimming) . I am not sure where you added the calculation but if this is a one time deal, this is how I would do it.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

I agree with Lesouef, if the trim() function doesn't remove the extra spaces, maybe they are not really spaces after all, but some other character, like tabs.

jvaldes is close - but just in  case that's not a space, you can use the LEFT function.

Put cursor into field. Under the RECORDS menu, Use REPLACE FIELD CONTENTS, and replace with CALCULATED RESULT. The calculation would be:

That should do it. You can use the same thing in a field calculation as well if you need it.

Hope this helps.

Rob A.
What happens if you've got 2 characters to remove at the end?
I would copy the string to a binary editor, then identify the guilty characters, then use the subst function to remove them. If it is a 'tab', you can enter it in a subst function by using 'Ctrl tab' in the calc window.
Here is a corrected formula for 2,4 5 or NO extra spaces. My last post just stripped off the last character. What a noob. :-)
Do your replace with THIS calculation. Note: this will fail if your field data ends with trailing punctuation or special characters like !@#$%^&*().


This seems to strip off the whitespace characters. I tested with spaces and tabs anyways....

Rob A
The filter() function is useful for removing non-standard characters from a string. If you know the range of possible legitimate characters that your data is made up of, you can use filter() to remove any characters that are outside that range.

The way it works is you provide a string to filter, and a string that contains all the characters that you want to be allowed.

This example will permit US upper and lower case letters, numbers, and common punctuation, but block everything else.
Result = Filter( MyString; "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),<.>/?" )
Filter() would work well for data that does not contain valid spaces. If the data contains 2 or more words, then spaces within the data would be stripped out....or the ones at the end of the data would be left on.

but you can filter, then trim to get both done if you'd keep internal spaces
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.