5 Replies Latest reply on Nov 9, 2010 4:19 PM by sunnysundaram

# Help with field validation calculation

### Title

Help with field validation calculation

### Post

Hi all

I am beginner in filemaker. I am creating a database file for my neonatal unit

It has got two number fields

1. Gestation (has got a value list (from 22,23, 24 to 42)

2.Weight

I want to validate the 2nd field (weight) so that it checks the numeric range entered for the second field(Weight) based on the choice of my first field(gestation)

eg. If I choose 24 in the gestation field, the weight range that I can enter is from 200 - 1200

If I choose 25, the weight range that I can enter is from 300 - 1400

If other value is entered , it will display an error message

Regards

Sunny

• ###### 1. Re: Help with field validation calculation

"I want to validate the 2nd field (weight) so that it checks the numeric range entered for the second field(Weight)"

Are you sure? I think you may have mis-typed. Please give us more (correct) info and everyone will be happy to help.

RW

• ###### 2. Re: Help with field validation calculation

This isn't very elegant, but I think it will work for your needs.

In the field Validated by Calculation put this formula, add your other parameters for gestation.

Case (

Gestation = 24  and Weight <  200 ; 0 ;

Gestation = 24  and Weight > 1200 ; 0 ;

Gestation = 25  and Weight <  300  ; 0;

Gestation = 25  and Weight > 1400  ; 0;

1  )

Out of range numbers get some nasty error messages which will make little sense to the average user about reverting the record so you might want to put the limits somewhere on the layout to give your users a clue as to what is the range for each gestation value.

• ###### 3. Re: Help with field validation calculation

Thanks very much to Bumper and Rick Whitelaw for your feedback.

I will try the above calculation you have mentioned.

Regards

• ###### 4. Re: Help with field validation calculation

The Case calculation will be very lengthy if you need to write it to encompass around 20 gestations, each having a min and max weight.

What might be a better approach, if you have the experience, is to create a "Gestation" table with each Gestation having its own min weight and max weight fields.  Then create a many to many relationship with your current neonatal table.

With the creation of the relationships and some additional fields, your validation calculation could simply be reduced to something like this:

If ( neotanal_weight* ≥ weight_min* and neotanal_weight* ≤ weight_max* ; 1 ; 0 )