1

Beginner Python programmer here,

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.

Any help?

0

1 Answer 1

1

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.

4
  • 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.
    – Smithw1
    Commented Apr 28, 2016 at 15:26
  • 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! Commented Apr 28, 2016 at 16:36
  • Is there anyway to modify the long integer at all? The description states if there are no records, but what if I want if there is 1 or less?
    – Smithw1
    Commented Apr 29, 2016 at 18:31
  • 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. Commented Apr 29, 2016 at 19:49

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