Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have exported my Model Builder model from ArcGIS to Python. What I am trying to do is provide some kind of clause saying "if the data selected has less than 2 records/features, skip it and go to the next iteration."
I have found information on SearchCursors and CurrentStates, but I am look at the entire feature. Not just the one field.
Based on your description are you looking for Get Count?
Returns the total number of rows for a table.
If the input is a layer or table view containing a selected set of records, only the selected records will be counted.
Ah, yes. I couldn't find something like that in my search, so I thought there would be something simpler going the python route/trying to expand my python knowledge.. Thank you.
Also, as the last example in the documentation shows, Get Count doesn't return a count - it returns a Result object, which contains the resulting count as a string!
I'm not sure you can do that with a precondition, but it's certainly something you can do with standard python looping. Get the count as shown in the example, and if it's under your threshold use a CONTINUE to skip it.