denisg Posted March 6, 2006 Posted March 6, 2006 Hello, Mac 5.5 server with Mac OS X clients environment. I am using this forumula "Length(TextToNum( Account Number) ) = 10" to validate if the user entered 10 integers and prompt if they have not with a message window. Formula works fine, except that this formula fails to recognize starting with zero "0" as a first valid integar. Example, if I enter "1234567890" formula works fine. But if I start with a zero "0123456789" the formula does not accept the starting zero as a valid number and fails as if the user has not entered 10 integers. All is well if the zero is in the middle and/or the end of the 10 integars. How can I modify this formula so a starting zero '0' can be accepted as a valid integer within the 10 integars... Thanks, Denis
Raybaudi Posted March 6, 2006 Posted March 6, 2006 Hi the right calc for the validation of field "Account Number" must be: Length(Account Number) = 10 ...and you have to check the "strict data type: numeric only" box
Lee Smith Posted March 6, 2006 Posted March 6, 2006 To add to what Daniele just posted, FileMaker drops the leading zero and the trailing zero after the decimal in calculations. Lee
comment Posted March 6, 2006 Posted March 6, 2006 How about: Length ( TextToNum ( "1" & Account Number) ) = 11
Raybaudi Posted March 6, 2006 Posted March 6, 2006 Hi comment not a good thought...so, for example, this will pass the test: abc0123456789
comment Posted March 6, 2006 Posted March 6, 2006 Yes it will. And so will 1234567890abc pass the current test, so maybe that's not the problem.
Raybaudi Posted March 6, 2006 Posted March 6, 2006 So you think that it is possible that denisg wished exactly 10 integer and some chars... uhmm... maybe (just because he used the TextToNum() function and really didn't specify ! )
denisg Posted March 6, 2006 Author Posted March 6, 2006 thanks to all. I have to have 10 integers ONLY...A zero at beginning of the integers is a must and at times a zero at the end of the 10 integers is also needed for the user to enter. Example "0123456789" and "0012340500" both example where zero is in beginning, middle and end must test and be valid...but can not exceed 10 integers and especiall characters of 'abc' can not be accepted and want the test to fail and prompt the user as error. Remember, my big problem is the user enters 'opqrst' where they start with an alphabet 'o' instead of zero.
Raybaudi Posted March 6, 2006 Posted March 6, 2006 ...but can not exceed 10 integers ... So, my first replay is exact ! But if you wish to allow minus than 10 integers too, the calc becomes: Length(Account Number) ≤ 10 Also, if the "0" at the beginning is a must, you can apply this calc: Length(Account Number) ≤ 10 and Left(Account Number;1)= 0
geod Posted March 6, 2006 Posted March 6, 2006 (edited) denisg, Assuming your Account Number field is a Text field then your formula "Length(TextToNum( Account Number) ) = 10" will fail when you have leading zeros because you are converting it to a number and leading zeros have no revelance to a number. In this case, if the Account Number field is a Text field then the formula in Daniele's 1st post is your answer. adios Edited March 6, 2006 by Guest
denisg Posted March 7, 2006 Author Posted March 7, 2006 Thanks so much to all. This formula "Length( TextToNum( "1" & Account Number) ) = 11" did the job...it's works exactly like I want it... Thanks again...Denis
Raybaudi Posted March 7, 2006 Posted March 7, 2006 Ok Now try to insert this text into that field: 01234A56789 and say us if the result is good for you.
denisg Posted March 8, 2006 Author Posted March 8, 2006 The formula fails with the letter 'A' as I want it to because I have the field strict data type as "number" so it blocks the 'A' from passing as valid data type. Also, have maximum number set to 10. It works exactly like I want it. Maximum 10 integers and '0' are accepted at the beginning, middle and end but no alphabets. Thanks again for your help...Denis
Recommended Posts
This topic is 6869 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 accountSign in
Already have an account? Sign in here.
Sign In Now