4

I'm creating a model in model builder that is very easy to construct and understand. However, I ran into a slight problem. The logic of the model is that it will take user selected features from a layer and append those selected features to an empty feature class with the same schema and field definitions. The problem here is that by default, all feature rows are returned in the Append tool if no selection is made. Is there any way to tell model builder to not append any features if there is no selection made? The final output in the empty feature classes should only be user selected features. I want to keep this automated, so I am open to a python script workaround if such a statement in python exists.

2 Answers 2

3

You can use the Get Count tool as a precondition to a tool. In the model below the buffer tool will only run if count is greater than zero and it's only greater than zero if the select by attribute tool actually selects anything.

Example model

1
  • That's exactly what I am looking for! A precondition! Thanks! I figured it was a simple solution. I just wasn't seeing it. Commented Mar 14, 2016 at 17:37
2

Use the Get Count tool in Model Builder as a Pre-Condition. If nothing is selected the tool won't continue as the condition (something selected) isn't met.

From the Get Count Help page:

In ModelBuilder, Get Count is often used to set up a precondition, as illustrated below. In this model, Get Count counts the number of records returned by the Select tool. If the count is zero, Buffer will not run due to the precondition

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.