Select to view content in your preferred language

Help with "If Field Exists" in Modelbuilder

175
1
08-06-2024 02:34 PM
gmaurer1123
Emerging Contributor

Hello all, 

So, I have this model, and so far, it runs pretty well (rare anomalous failure here and there).

gmaurer1123_2-1722978407181.png

 

However, because of updates to the source data I need to get this model to run with an "If Field Exists" logic. Basically, I want the model to iterate though some feature classes, and if a field exists, I want it to calculate another field and continue on with the downline processes. If the field does not exist, I want the model to add the field, then calculate the field and continue on with downline processes. I've set both True and False as preconditions for the processes I want them to carry out, but nothing downline will validate. 

gmaurer1123_1-1722978298627.png

And if I try to reconnect the output (i.e. "Selections") to the "Add Field" tool, the model will validate but will generate an empty output because all the Inputs are not current. 

gmaurer1123_3-1722978683075.png

I'm lost in the sauce over here. Please help! Thank you!

 

 

0 Kudos
1 Reply
AlfredBaldenweck
MVP Regular Contributor

To clarify, you want to check if FieldA exists, then calculate it if it does, OR add, then calculate it?

Doesn't Field Calculator just create the field if it doesn't already exist?

0 Kudos