Model Builder IF feature class name =

275
3
06-09-2019 01:15 PM
EvanButterfield
New Contributor II

Hello, I'm looking to create a model that breaks a single feature class into multiple feature classes based an attribute value and then looks for a feature class name and alters fields names, deletes unnecessary fields, and renames the feature class. I've created a model that creates the feature classes and also created a model that alters fields, deletes fields, and renames the feature class. I'm looking to create one model, so basically, after the first model that creates a gdb with multiple feature classes, i think i need something like an IF statement where: if feature class name == XXX run model two that alters fields, delete fields, and renames the feature class based on the specefic feature class name.

Below are examples of the two models, right now each feature class would have to be it's own model to alter, delete, and rename because the input parameter is required and the gdb created in the first model may have all or only some of the feature class names. Is there a way to iterate through a gdb and look for a specific feature class name? any help would be appreciated.

Thank you!

0 Kudos
3 Replies
DuncanHornby
MVP Frequent Contributor

The output of the split by attribute tool is a workspace as stated in the syntax section of the help file. You need to create a sub-model with a featureclass iterator and place your other models (or their contents) into the sub-model. Then connect that sub-model to the output of the split by attributes tool which is in the master model. You'll need to expose inputs/outputs as parameters to allow them to connect, that is all discussed in the help file.

0 Kudos
EvanButterfield
New Contributor II

Thanks for the reply Duncan. I've tried setting the first model as a precondtion then using the created gdb and iterate feature class. However, the alter fields tool has a required input parameter so i'm getting an error when it is trying to run saying it is invalid. I've tried using inline variables as a place holder but no luck.

0 Kudos
curtvprice
MVP Esteemed Contributor

Whenever I have run into intractable tool validation issues I have accessed the tool using the Calculate Value tool with a python function. A little Python goes a long way in Model Builder!

0 Kudos