Model Builder Precondition (Get Field Value) run error thinks its Null despite correctly collecting a value.

286
2
11-08-2020 08:48 PM
AaronKing3
New Contributor II

My model collects two values using the Get Field Value model-only tool. The table it is pulling these values from has no nulls in it. The two Get Field Value tools are preconditions for a Calculate Field tool.

When I run the model, it fails to execute the Calculate Field tool, giving an error:  "The process did not execute because the precondition is false." 

When I stop the model after I get the error, the Get Field Value outputs have non-null values in them. 

They are not boolean, so i do not understand why "False" is being reported to the Calculate Field tool.

The Model Readout as it runs:

...

Executing (Get Field Value): GetFieldValue "X:\2019\19-107 Sac Valley WQC - 2020 GW Services\GIS\SVWQC_HVA_AMK_v2.gdb\Temp_NSummary" MAX_Model Double -1
Start Time: Sunday, November 08, 2020 8:37:31 PM
Succeeded at Sunday, November 08, 2020 8:37:31 PM (Elapsed Time: 0.05 seconds)
Executing (Get Field Value (2)): GetFieldValue "X:\2019\19-107 Sac Valley WQC - 2020 GW Services\GIS\SVWQC_HVA_AMK_v2.gdb\Temp_NSummary" MIN_Model Double -1
Start Time: Sunday, November 08, 2020 8:37:31 PM
Succeeded at Sunday, November 08, 2020 8:37:31 PM (Elapsed Time: 0.05 seconds)
Executing (Calculate Field): CalculateField N_WelltestsDissolved_AllAttributesAssigned Model (!Model!-0)/(48.5839991620112-0) "Python 3" # Text
Start Time: Sunday, November 08, 2020 8:37:31 PM
The process did not execute because the precondition is false.
Succeeded at Sunday, November 08, 2020 8:37:31 PM (Elapsed Time: 0.00 seconds)

,...

2 Replies
DavidPike
MVP Frequent Contributor

Make a separate model with those values hardcoded as input into Calculate Field and see what happens.

0 Kudos
DuncanHornby
MVP Frequent Contributor

I have just stumbled over the same scenario and resolved this issue in my own processing. I see from the log  you have extracted out the min and max value to be used to normalise a field in your field calculate tool and quite understandably you have made the Get Field value tools preconditions to the Calculate tool. I too had created a model to do exactly the same and my calculate tool would not run.

The reason why this happens in that a ZERO value is interpreted as a FALSE value in model builder if used as a precondition.

But! Zero is your minimum value, a perfectly acceptable value, which is being used to normalise a field. So if zero is an appropriate value but you try to use it as a precondition then that will halt processing in model builder. A chicken and egg scenario!

So how do you get around this?

My trick is to feed both the outputs of the Get Field Value tools into a Collects Value tool. This creates a LIST of values, in your case a maximum value and a minimum value (which is zero). It does not matter what is in the list, but a list now exists and that evaluates to TRUE in model builder. So even though I create a list, not even interested what's in it, by using it as a precondition because the list exists then the precondition is TRUE and the calculate field tool is allowed to run.  For the list to exist it needs to run the Get Field Value tools first and this ensure the correct logical sequence you need, i.e. get the min and max values which feed into your normalisation equation.

0 Kudos