[GIS] Returning feature with maximum OBJECTID from Select By Attribute tool of ArcMap

arcgis-10.2arcgis-desktoparcmapselect-by-attribute

I want to get the maximum OBJECTID from a layer using "select by attribute" tool. But the result is not with the maximum OBJECTID.

When I use "select by attribute" tool to get the maximum last_edited_date, I also cannot get the latest date value.

The feature with the maximum OBJECTID and last_edited_date is newly created.

The sql statement used in the :select by attribute" is as follows:

enter image description here

The result of the selection:
enter image description here

The reason of getting the maximum OBJECTID and last_edited_date is I want to set the attribute value for the feature and after that create a buffer around the newly created feature.

I am using arcmap 10.2.

Best Answer

As an alternative to using the Select By Attributes tool alone, I recommend writing a short Python/ArcPy script tool which uses:

  1. Summary Statistics to get the MAXIMUM value of OBJECTID
  2. arcpy.da.SearchCursor to read the value of the MAX-OBJECTID field in the first (and only) row of the table that results from 1.
  3. Select By Attributes to select the feature with that maximum value of OBJECTID that results from 2..