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 6988 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm a new FM and need help. I have a client who has a database with a text field where users enter normally 10 integers. Now I want to:

1) test for 10 integers, and if less, prompt the user and yet still allow them to enter 1-10 integars.

2) make a test to force users to enter integers only becuase sometimes they mistakenly enter/mix letters with the integers.

3) I cannot lose old data from this field.

Thanks,

Denis

Posted

Hi denis,

Its very easy.

In the define fields window, select your text field and then press options...

There go to the validation tab and you will find that you can set "strict data type" to numeric only and "maximun number of caracters" to 10.

You can also set a custom message to be displayed when the validation fails.

ZZ

Posted

Hi Denis,

I hope I didn't jinx you're getting help on the other thread here . If you don't get a response on a thread in the future, just bump it. This means, just post on it again, with the words 'bump' or 'any ideas here' etc. Sometimes posts can get lost in the shuffle.

1) test for 10 integers, and if less, prompt the user and yet still allow them to enter 1-10 integars.

You need to validate that text field through its field definition Options (Validation tab). Validate by Calculation. Using Maximum number of characters won't work for this. The following calc will fail validation if 10 integers aren't entered. This will also trap for text because text won't be counted (but text will NOT be removed (if you want text removed, just let us know):)

Length(Filter(text ; "0123456789") ) = 10

2) make a test to force users to enter integers only becuase sometimes they mistakenly enter/mix letters with the integers.

Below on the Validation tab, click checkbox to enter a message, something like: "10 numbers are expected. Accept anyway?" User can click "Yes" to override and accept the entry.

3) I cannot lose old data from this field.

I have no idea what this means... :wink2:

LaRetta

Posted

The request is to prompt (fail validation) for < 10. Maximum fails validation > 10, no? It probably is more an issue of our interpretion of his request, I suppose. At least he's now covered either way. Thanks for speaking up... :wink2:

Correction ... request is to fail validation for < > 10 which will be achieved by the Length() calc I posted . This first sentence indicates < 10 because that is the wording used by Denis, but 1-10 means not allowing MORE than 10 either, hence the = 10.

LaRetta

Posted

IIUC, he wants STRICT validation on numeric-only and not empty, but only a WARNING when there are less than 10 digits. Using only field validation, these are conflicting demands. Better to have a global field for entry, then validate by a script.

Also, he stated this is for version 5, so you need to use TextToNum() instead of Filter(). And watch out for a single "y" or "n".

Posted (edited)

LaRetta

You where correct, the validation would only work for length > 10 not for < 10 (it should be an option in the define fields as well).

Mis disculpas.

ZZ

Edited by Guest
Posted

Hi Michael,

Point 2 (strict validation number only) seemed clear until I read "[color:green]I cannot lose old data from this field". That set me to wondering whether he might have data which needed to be preserved which is why I made the Comment (smile), "if you want text removed, just let us know."

My contingency was simple: If text truly should be removed then Auto-Enter (Replace) could simply clean up the field viz: Filter ( text ; "0123456789" ) and we could shorten his validation to Length(text) = 10 (not Strict). Two types of validation would be unnecessary and I saw no problem with this approach. I do now ... :crazy2:

I had looked at version in sidebar (I think) but I HADN'T noticed the version on "this post." Sorry for my error, Denis.

Michael, I was sloppy and I appreciate the correction! :wink2:

LaRetta

Posted

I just got in town and read the thread. Both of you thanks so much. I got the strict numbers, maximum of characters = 10 and prompting the user. But I still need help with the validation if <10 integers. I am Macintosh FM 5.5 and could not use LaRetta's "Filter" formula, as well, I don't know how to script using function TextToNum(). Can you please give me the formula and I'll put in "Validate by calculation."

Thanks so much...Denis

  • 3 weeks later...
Posted

Hello,

I am still not sure how to check if field < 10 integars. Prompt user if < 10 integars with a message window but still allow as sometimes they enter 8 integars.

Can someone give me the script to test the field?

FileMaker 5.5 server Macintosh

Thanks,

Denis

Posted (edited)

Hi

this calc is for you:

If(Length(TextTo[color:red]Num(digits)) < 10;0;1)

or, simpler:

Length(TextTo[color:red]Num(digits)) = 10

(this is a boolean calc... if the user will enter less than or more than 10 digits or some chars, the result will be "false", so the validation will fail).

Remember to check also the Strict data type: numeric only !

* the English function name is TextToNum, not TextToNumber...so I'm editing !

Edited by Guest
wrong function name
Posted

Hello Daniele,

Thanks for your reply to my post. I tried the formulas in the 'Validate by calculation' and am getting this same error when using either of the two formulas: "Either an operator was omitted, this function cannot be found, or "(" was not expected here." When I hit OK, FM highlights the 'TextToNumber.

Thanks to you and all those helping,

Denis

Posted

Hi

I have an Italian version of FM6; there the function is named: TestoANumero, so I was thinking that in the English version the name of the function is: TextToNumber...

But may be I'm wrong !

Please, check the right name in the list of your text functions !

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