Locating skipped field values

993
2
02-23-2011 10:05 AM
PatMadsen
New Contributor II
Hi -
I have access to tools that assist with various field calculations, but what I do not have is a way of identifying any skipped values/records in my data... for instance, I have a feature class with over 1500 records and each of them are attributed with consecutive number values; there are 3 incidents of skipped values and I would like a quick way to locate where these are.
Thanks!
Pat
0 Kudos
2 Replies
JoeBorgione
MVP Emeritus

Skipped meaning  they are out of order from the others?

1

2

3

17

4

5

6

23

7

8

9

10   ?

Can you sort ascending or descending to find them?  Look for duplicates?

That should just about do it....
0 Kudos
DarrenWiens2
MVP Honored Contributor

You can get at this with Python:

>>> fc = 'points' # feature class/layer
... field = 'Id' # field to inspect
... start = 0 # first value
... stop = 25 # last value
... step = 1 # increment value
... present_values = [i[0] for i in arcpy.da.SearchCursor(fc,field)] # load present values to list
... missing_values = [i for i in range(start,stop,step) if i not in present_values] # compare present values to possible values
... print missing_values‍‍‍‍‍‍‍‍ # print list, or do some thing with values
... 
[0, 9, 15, 16, 21, 22, 23, 24]