Jump to content

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

Recommended Posts

Posted

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

Posted

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 :D

Number=0 or (Number>10 and Number<50)

Regards,

Peter

Posted

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.

Posted

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

Posted

FieldName > "10" and FieldName < "50"

This will return true if FieldName = "100", for example.

Better make it

GetAsNumber ( FieldName ) > 10 and GetAsNumber ( FieldName ) < 50

Posted

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 :D:Area = 0 or (GetAsNumber ( Link :P:Area ) > 10 & GetAsNumber ( Link ::Area ) < 50

==============

Posted (edited)

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 by Guest
Posted (edited)

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 by Guest
Posted (edited)

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 by Guest
Posted

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

Posted

1."&" is a text concatenation operator - you need to use the "and" logical operator :exactly:

Now WORKING. Thanks for all the help. It's appreciated.

John

Posted (edited)

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 by Guest
Too late!

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