Learning Model Builder

416
2
05-21-2020 09:17 PM
BethanyHall3
New Contributor

I'm not the best model builder but I'm trying to write a model to that uses a select by attributes on a streets feature class for a value and then I need to change all the selected features to a new value that is defined through a field calculation. The image below is the model I have crafted but I am running into errors and I cannot figure out how to get around these errors.

First, I have a feature class named roadcenterline in a file geodatabase and I want to select from the attributes all the features that have the two characters "FT" in the field ONEWAY and then change those selected features using a calculate field to only one character "F". I want keep everything in the same feature class and just change the attributes of the selected features. I then have to repeat the process on the same ONEWAY field for two more values, "TF" to "T" and "UNK" to "B".

In the Select, I see a red X by the feature class where I want to store the results of the selection. It is the same feature class the selection is based upon. Do I have to create new feature classes each time for the selection process and new feature classes for the calculate field, too? If so, how do I get them all back into the same feature class?

I've been running these series of selections and field calculations by hand each time I edit the data and I'm trying to figure out how to create a model to do all this for me.

Thanks,

Bethany Hall

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

Hi Bethany,

I guess you could allow overwrites in your geoprocessing settings, but as you are still building your model, I would save the Select outputs as new features just in-case something unexpected happens. You can specify an output location in the scratchWorkspace to make clearing out easier. The overwrite outputs of geoprocessing operations option will also allow you to keep writing to those scratch features each time you run the model.

when it comes to bringing everything together, you can use the Merge geoprocessing tool (not the editing tool) to bring all that data back into one feature.

0 Kudos
Robert_LeClair
Esri Notable Contributor

Hi Bethany - so I figured out how to make your workflow work in ModelBuilder.  The first thing I did was to use 'Select by Attribute' as it does not create an output feature class as 'Select' does.  Then I used the "Make Feature Layer" to create an in-memory feature layer for each process.  In the first 'Select by Attribute' - this can be your 'FT'.  The second 'Select by Attribute' - this can be your 'TF'.  And the third  'Select by Attribute' - this can be your 'UNK'.  Set the appropriate Calculate Fields parameters and your good to go.  See the attached screen grab of ModelBuilder to reference what I did.  Tested and works!