I need to label only the latest feature in a particular feature class. I actually would like to automate it, so that when I will add any new feature to this feature class, the label will automatically be assigned to the latest one. Could anyone please help me with line of code?

  • 1
    Since you are adding a feature, it will have the highest FID. Accordingly, all you should need to do is get the number of features (possibly subtracting 1). – Paul Jan 17 '14 at 2:02
  • Using ArcGIS 10.1 – Pushkar Jan 17 '14 at 5:57
  • 1
    What type of geodatabase is your feature class stored in? Please use the edit button beneath your Question to revise it with this detail. – PolyGeo Jan 17 '14 at 6:02
  • 1
    you could use a TOP 1 query on a second layer based on the FID. see gis.stackexchange.com/questions/53948/… (DESC to reverse the sorting) – radouxju Jan 17 '14 at 8:17

Pushkar, I have done the following to answer this question using OBJECTID in a File Geodatabase and it works for me: Within the labeling tab in the layer properties - choose method of Define classes of features and label each class differently Then within the SQL use the following:

"OBJECTID" = (SELECT MAX("OBJECTID") FROM feature_class_name)

Then you can just set your label field to the field you want and only the largest OBJECTID will label.

  • @Pushkar if that works for you - please click the check mark beside my answer. Thanks! – dklassen Jan 23 '14 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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