1

The model that I'm now building in ModelBuilder will take as an input a certain feature class that may, or may not, have a certain field. I would like the model to check for the presence of that field and select only certain records by it if it exists. If the input doesn't have that field, the model is to skip this step and proceed straight to what it what do afterwards. At If statement in ModelBuilder to check if field exists, the Python script for something similar is discussed, but I wonder if it is possible to do this in ModelBuilder somewhat differently--i.e., export the selected features to a new feature class if the field exists. What tools should one use for this if this is possible?

closed as off-topic by PolyGeo May 25 '16 at 23:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What does your test model for doing this look like so far? If you use a Python script tool in your test model (which I would expect you to need to) then can you include its code too, please? – PolyGeo May 25 '16 at 23:15
  • As yet, the model does not test anything. It simply proceeds assuming that there is no such problem field. I am no longer sure whether there is any point in doing so, considering that I don't know what that field's name might be in the future, or whether there are any other such "problem" fields. I was simply trying to find out whether there already was a way of testing for the existence of a field. Now it seems that there isn't, and that I would have to create my own tool for doing so. – Mhoram May 28 '16 at 2:10
  • I try to keep my models simple by extracting if-then logic out into Python script tools. In this case I would make a "Select if field present tool". By test model I mean a tiny model that just illustrates this particular piece of functionality. – PolyGeo May 28 '16 at 2:16