July 28, 200520 yr I'm sure this is an easy one but... I want to validate a field to accept only 00 or >10 and <50 (i.e. 00 or between 10 an 50) I entered exactly as above but just got an error message
July 28, 200520 yr You have to explicitly mention the fieldname in the validation calculation. So if the field you are trying to validate is called Number, the validation field would be Number=0 or (Number>10 and Number<50) Regards, Peter
July 28, 200520 yr Is this a number field or a text field? For a number field try: FieldName = 0 or (FieldName > 10 and FieldName < 50) For a text field try: FieldName = "00" or (FieldName > "10" and FieldName < "50") FieldName is the field you are validating.
July 28, 200520 yr With a field called number. Number > 9 and Number < 51 or Number = 0 And be sure to deselect the "Validate Only If Field Has Been Modified. HTH Lee
July 28, 200520 yr FieldName > "10" and FieldName < "50" This will return true if FieldName = "100", for example. Better make it GetAsNumber ( FieldName ) > 10 and GetAsNumber ( FieldName ) < 50
July 28, 200520 yr Author No joy here. I must be missing something. The field is Area (Type number) I have tried both suggestions, but entering for example 55, produces no error. ============== Validation: Only during data entry Strict data type: Numeric Strict validation Maximum data length: 2 Error message: Out of Range Calculation: Link :Area = 0 or (GetAsNumber ( Link :Area ) > 10 & GetAsNumber ( Link ::Area ) < 50 ==============
July 28, 200520 yr This doesn't make sense. Area codes have more than two numbers in the U.S., they are either 5 or 9 numbers. Give is an example of the number you are using. or better yet, explain what you have now and what you want to happen. I have a feeling that somewhere along the line, something is being left out. The calculations given will work with what you described originally, as I test mine before posting. Lee Edited July 28, 200520 yr by Guest
July 28, 200520 yr Area may not mean Area Code. Regardless, validation will not happen until the User exits the field. Oh. Forum was down and I couldn't get back. Your calc is wrong. And since we know it's number, try: not Area or Area > 10 and Area < 50 Not & but and Use Comment's instead. :grin: Edited July 28, 200520 yr by Guest
July 28, 200520 yr If Area is a number field, GetAsNumber() is not required. However, the syntax of your calculation is incorrect: 1."&" is a text concatenation operator - you need to use the "and" logical operator; 2. Link::Area is a related field - you need to refer to Area from the current table. This is the correct formula: Area = 0 or Area > 10 and Area < 50 --- "00" is not a number. Although Filemaker will accept such entry into a number field, and even remember it as such, its numeric value will nevertheless be 0. Edited July 28, 200520 yr by Guest
July 28, 200520 yr Author Lee Nothing to do with US. The field is just reflecting geographical areas which someone has already decided on, and marked on a map. Area 10 might be a specified part of a town/city. Area 11 a different part of a town etc. The numbers that are used to represent these areas fall within the ranges I am trying to validate. LaRetta "validation will not happen until the User exits the field" or at all, at the moment
July 28, 200520 yr Author 1."&" is a text concatenation operator - you need to use the "and" logical operator Now WORKING. Thanks for all the help. It's appreciated. John
July 28, 200520 yr Try validating by value list. I'm guessing these area numbers are all integers. So how long would it take for you to produce a custom value list of all the entries that you would like to be valid? I see you now have it working OK so ignore my suggestion Edited July 28, 200520 yr by Guest Too late!
Create an account or sign in to comment