I have set up a simple model that will select features in a feature class (personal geodatabase) based on an expression and then output the selected features into a new feature class. I have set up an iterator so that I can select the feature dataset and it will run the above described process on each feature class in said dataset. The problem is that the model will create an output feature class whether the select criteria was met or not. In other words, whenever there is a feature class that does not meet the criteria, nothing is selected, then it creates an empty feature dataset. I want to either avoid the creation of these empty datsets, or delete them on the back end. I can't figure out how to do either in model builder (I don't do code...sorry). Image attached...I would greatly appreciate some help with this one.
Use the iterator and connect the output feature class (green oval) as input to Make Feature Layer tool.
Use Make feature layer tool to make a selection based on your sql query. Connect the output to the Get Count tool.
Get Count tool (see help on this tool) - if there are any selected features the output of get count tool is 1 and the tool connected to it downstream will run. if no features are selected, and the count is 0, the output of get count will be 0 and the downstream will not run.
Copy features in the end with output of make feature layer tool as input to the tool and output of the get count as the precondition to the tool.