Model Builder:  Continue Processing If Features Selected

759
2
08-26-2013 03:59 PM
by Anonymous User
Not applicable
Original User: kafros

I have a feature class that may or may not have a number of features selected.  If there are features selected, I want to process them using a Model Builder sequence I have prepared.  How do I check "if features are selected, continue, otherwise stop processing"?  I tried the following from looking at another post, but regardless whether the Boolean Output is "True" or "False", the model still continues processing past the Boolean Output point.  Does anyone have any suggestions to either improve upon my sequence or another solution that will do the checking for selected features?

Attached are two screenshots.  One is the sequence I set up in Model Builder, with the "check for selected features" Calculate Value first, and the second is the code within that Calculate Value tool.

[ATTACH=CONFIG]27006[/ATTACH]

[ATTACH=CONFIG]27007[/ATTACH]

I would assume this is pretty basic, but it's stumping me.  Thank you for any assistance.
0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: bruce_harold

Kirsten

Use a GetCount process to find if you have a non-zero selection and make it a precondition of the process you want to run if you have a selection.

Regards
0 Kudos
KirstenFrost_Andersen
New Contributor III
Thank you, Bruce.  It sounds like a very simple solution, and though it took me a while, I figured out where the Get Count tool is and I think I was able to make it a precondition -- never used either technique before.  When I connected the Row Count to the next step in the process, I chose Precondition from the context menu.  I assume that's how I'm supposed to do it.  Unfortunately, even without a selection in my Layer, the Dissolve tool still ran in this example.  I'm sorry to ask, but can you take another look and see if I've missed something?  I'm still quite at amateur level with Model Builder.

Thanks!

[ATTACH=CONFIG]27019[/ATTACH]

[ATTACH=CONFIG]27020[/ATTACH]

Edit:  Thinking about this further, and looking at the Python generated from the model, I can see that there's no check for "number of rows SELECTED" in this.  I'm not sure how to do that part with the Get Count tool.  Can you give me specifics as to how you recommend that part is done?  Much appreciated!
0 Kudos