Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Hi Everyone!

This is such a simple thing, but for some reason I cant figure out how to do it, nor can I find any info online about this.

How do I validate a field using a calculation to remove spaces or carriage returns in a field.

For example lets say I type "hello 123", I want it to automatically appear in the field as "hello123", or if I type "hello123 ", I want it to appear as "hello123"

Thanks!

Posted

Removong spaces you could use an auto-enter, replace existing value of

Substitute(Text;" ";"")

and if in addition you want to remove carriage returns

Substitute(Substitute (Text ;" " ;"");"¶";"")

Posted

I was thinking something along the lines of validating the field with a calculation. What would the exact calculation be?

I tried validating the field using this calculation: [color:red]Substitute(Text;" ";""), but it still doesnt work.

Posted

Validating will not change the data; it will alert the user that the data is invalid and must be changed.

An auto-enter calculation with 'do not replace existing value' deselected WILL change the data as required, without alerting the user that the original data was invalid.

If you still would rather validate than automatically correct the data, use

not (Position( fieldName; " "; 0; 1 ) or Position( fieldName; ¶; 0; 1 ))

or

not (PatternCount( fieldName; " " ) or PatternCount( fieldName; ¶ ))

Posted (edited)

Thats brilliant. I'm sorry I didnt realize that validating would only warn someone. Changing it automatically via the auto enter is a much better solution. Thank you so much!

One more quick thing.

If I want to just delete a leading or trailing space in another field, how would I approach that?

Edited by Guest

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