Brian Dunning's FileMaker Custom Functions

TrimAll ( LeftWords ( field_you_want_cleansed ; 999999 ) ; 0 ; 0 )

This will remove extra spaces typed between words and extra returns typed after the last word.

  Be the first to rate this function Log in to vote

Dr_John   Dr_John - Show more from this author
none

Share on Facebook Share on Twitter

  Sample input:
RCConsulting is the best




  Sample output:
RCConsulting is the best

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Use this as an auto enter calc in any text field that might have extra spaces or returns at the end.

The Sample Input field is trimmed (thanks Brian), so you don't see what I typed in that field but it had extra spaces between words and extra returns at the end. Takes out extra spaces between words, leaving one space each, and any extra returns at the end. But Not extra returns in between word which hopefully some could add to this.

 

Comments

Emmeuno   Emmeuno
Jul 30, 2019
Sorry, i don't understand how use it. Can you explain, please? Regards
 
Dr_John   Dr_John, none
Jul 30, 2019
You can't tell what it does from the input field on the site, but if someone types text with extra spaces in between the words and/or extra returns after, like is often done, it will reduce the spaces to just one, and clear out the returns at the end. It's good for things like names and addresses in labels.
 
Emmeuno   Emmeuno
Jul 31, 2019
The purpose is clear but I don't know how to apply it. I used a Surname field, created a custom function called Check and with Field as a parameter. The Surname field has a validation via "Check Surname. At the exit of the field I have an alert message for invalid characters entered.
 
Dr_John   Dr_John, none
Jul 31, 2019
in a regular field
put the function I wrote in the options/auto enter/calculated value, specify,
put the name of your text field where it says "field you want cleansed"
uncheck do not replace existing value.
 
Emmeuno   Emmeuno
Jul 31, 2019
Thanks, it works perfectly. Sometimes the difficulty lies in knowing where to write the suggested functions. Regards
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: