4 Replies Latest reply on Feb 12, 2015 1:24 PM by amandahbell

# Field validation using calculation of calculated field not validating after operator in calculated field changes

The Set-up:

I have three fields:

WaterTemp

WaterTempUnits

WaterTempCelsius

I need to make sure that the combination of WaterTemp and Units is within  -10.0 - 50.0 °C.

WaterTempCelsius is a calculated field with the following Calculation:

Case (

WaterTempUnits = "Celsius";WaterTemp;

WaterTempUnits = "Kelvin"; WaterTemp - 273.15;

WaterTempUnits = "Fahrenheit"; ((WaterTemp-32)/1.8);

)

I turned off Indexing in hopes that would cause it to always calculate.

The Validation for WaterTemp is:

WaterTempCelsius  ≥  -10  and WaterTempCelsius ≤  50

I added a Message that states the range it is supposed to be. I have the "Always" checked for Validate in this Field and not allowing user override.

The Problem:

When I put in a WaterTemp that is within the range in Celsius (say 0) and have the units set to Celsius. I do not get an error.--GOOD

When I put in a WaterTemp that is within the range in Celsius (say 0) and then CHANGE the units to Kelvin (result -273.15 °C). I do not get an error.--BAD

When I modify the WaterTemp with the units selected it validates.--GOOD

The Question:
How do I make sure the validation is run if I change the Units?

I've only had FileMaker for 4 days, so be gentle.

• ###### 1. Re: Field validation using calculation of calculated field not validating after operator in calculated field changes

amandahbell wrote:

The Question:

How do I make sure the validation is run if I change the Units?

First thing that comes to mind is:

Try setting up a calculation that reverses the Celsius result calculation, and validate that value; i.e.,

Let (

Case (

WaterTempUnits = "Celsius" ; WaterTemp ;

WaterTempUnits = "Kelvin" ; WaterTemp + 273,15 ;

WaterTempUnits = "Fahrenheit"; ( WaterTemp + 32 ) * 1,8

) ;

)

Please check the math; I simply used the reverse operators from the other calc …

<section:>:

<description>

setup

• ###### 2. Re: Field validation using calculation of calculated field not validating after operator in calculated field changes

What if you apply the same validation to the WaterTempUnits field?

• ###### 3. Re: Field validation using calculation of calculated field not validating after operator in calculated field changes

In this particular case I would put a trigger on the modifiable fields that runs a script whenever there are changes, see enclosed example. No validation on the contents themselves.

• ###### 4. Re: Field validation using calculation of calculated field not validating after operator in calculated field changes

I used the Let functions and then figured out I made a rookie mistake and didn't un-click the Validate only on modification box.

THANK YOU!