7 Replies Latest reply on Feb 3, 2010 5:32 PM by LaRetta_1

    Removing Spaces



      Removing Spaces


      I use Windows XP and FileMaker 10. I have created a text field and I am copying text information from a PDF file and dropping it into the text field in FileMakerr. I have a lot of spaces between words and lines on the copied text. I have been stripping out the spaces manually and would like to know if it can be done automatically in FileMaker. I see under FileMaker Pro help there is something called TrimAll that seems like its what I want. I just can figure out how to get to TrimAll. Can anyone help me.

        • 1. Re: Removing Spaces

          Set up an auto-enter calculation like this:




          Clear the "do not replace existing value option" also.


          When you paste text with spaces into this field, the auto-enter calculation will then trim out the extra spaces.

          • 2. Re: Removing Spaces
               TrimAll() is missing its Trimtype and trimspaces, Phil. :smileyhappy:
            • 3. Re: Removing Spaces
                 You'll have to forgive me. I don't know how to set up an auto-enter calculation. Could you offer some direction on how to do that? Thanks
              • 4. Re: Removing Spaces

                Wouldn't Trim suffice?


                To add this, go to Manage -> Database


                Go to your table and double click the field, then in the first tab (Auto-enter) choose Calculated Value.


                Type the Function Trim(Self)


                Click OK


                Then uncheck Do Not replace existing value 

                • 5. Re: Removing Spaces
                  Steve Wright

                  " I have a lot of spaces between words" 


                  Trim() only removes leading and trailing spaces

                  TrimAll() can remove additional spaces between words


                  I believe this is what is required...


                  TrimAll(Self ; 1 ;2) 




                  1:  if you want to include the removal of full-width spaces between non-Roman and Roman characters.


                  2 : Removes spaces between non-Roman characters (reduce multiple space between non-Roman and Roman words to 1 space; do not add spaces if there are none; always leave one space between Roman words). 

                  • 6. Re: Removing Spaces

                    Thank you, SW.  TrimType selections are 0-3.  I didn't specify which should be used because I don't know the background of the person posting so could only suggest what *I* use.  I think that FM Help is very unhelpful in the explanations. 


                    So here is a wonderful explanation that I was lucky to receive 5 years ago (which still holds true):


                    TrimAll Roman / Non-Roman


                    I wish FMI would just grab Comment's explanation and include it in the Help files but ... well, they have their own people who put things together such as the Knowledge Base that think they know more than our top Developers. :smileytongue:

                    And this has nothing to do with FM ... a toast to a wonderful teacher ... JT (-Queue-).  I still hear your words every day (unless I forget them like a human can but that doesn't mean they aren't very important to me.) :smileyhappy:
                    • 7. Re: Removing Spaces

                      Ayers wrote:
                      You'll have to forgive me. I don't know how to set up an auto-enter calculation. Could you offer some direction on how to do that? Thanks

                      Hi Ayers,  Go to File > Manage > Database and the Fields tab and find your field.  Select your field and then the button Options (lower right).  The first tab (at the top will be auto-enter).  Towards the bottom, select 'Calculated Value' and type your calculation.  When you exit out of the calculation and are back at the auto-enter tab, you will see a checkbox right below 'calculated value' Specify ... and the checkbox will say, "Do Not replace existing value for field (if any)".  


                      If you uncheck this box, it means that, every time the value is changed, FM will apply the calculation and change your data.  So if, even after a record is created, a User adds an extra space when they change this field, the calculation will still fire and remove the extra spaces, as you've desired (by your choices on TrimTypes). I hope that made sense, if not, please ask.  There are many wonderful people waiting to assist.