Use a calculated Replace Field Contents with calc:
Trim ( Self )
Thank you both very much for the prompt reply. I'm very new to FM and databases in general. Can you tell me how to execute the Trim function? Do I create a new field, then use the trim function to populate the content in that field?
Thanks for your patience.
As explained by Daniele, use Replace Field Contents.
Then if manually: Show all your records and place your cursor in the field and then select Records > Replace Field Contents and specify 'replace with calculated result'.
If by script: Create script-step of Replace Field Contents
... then enter your calculation. However, you can't use Self this way (Self can't be used with Replace Field Contents) so you will have to use Trim (yourField) then select button Replace.
ADDED: Always back up first. And remember that, even if you error trap, Replace Field Contents should not be used if multi-user and Users may be locking a record so run when Users aren't in system.
Self can't be used with Replace Field Contents
You are right, thank you.
Thank you LRetta. Very kind.
Can you provide a step-by-step on how to create a script to trim all the records in a field, please? I have 260 records. I have 3 fields that contain various single word entries. Many of the entries have spaces at the end of the entry. I would like my script to replace every entry across all 3 fields with itself and without the single space at the end. I'm new to FM, and struggling to understand the proper protocol for script creation.
Thanks in advance.
To clean up your current records (on those three fields), handle it manually as explained above. To keep extra spaces from those fields going forward, go to the first field in File > Manage Database, select the field and click Options. Under the auto-enter tab, go down and click the Specify next to 'calculated value'. Here, you can use Daniele's calculation of Trim ( Self ). Say OK then when back at the auto-enter tab, UNCHECK 'do not replace existing value for field if any.' Repeat with each field, entering Trim ( Self ) in each one.
Now if a user adds a beginning or trailing space by accident, it will be automatically removed when the user exits the field; no script needed. You'll never have to clean up spaces in these fields again. NOTE: You do not have to worry about trailing/leading spaces in Date fields because they are not allowed.