My feature class contains two fields: an identifying field
U_ID, and a descriptive text field
DESC. This field currently has
<Null> for all features. I would like to select all the features with the same ID and populate this field with sequential values (using code I have previously used here), only if there are
<Null> values in
My model receives the feature class as input into a
Feature Selection Iterator, grouping by
U_ID. I then want to check for null values in the
DESC field for those
Selected Features. If a
<Null> is found in
DESC for any of the
Selected Features, return true and populate the field with values. If there are values for all the features, the condition is false.
This is what the model looks like:
For example: the iterator selects
U_ID = AA01. There are ten features in the feature class with that ID, so
Selected Features contains those 10 features. The
Calculate Value tool contains the following:
def checkIfNull(f): return "true" if not f else "false"
<Null> for those ten features (or even just one of the features), the precondition is true, and
Calculate Field DESC should be executed. However, the precondition returns false and the model ends. Changing the code to
return "true" if f is None else "false"
yields the same result. I don't think I'm accessing the values in
DESC correctly, because my test for
<Null> seems to be right, judging by the answers to other questions here.