1

So I have a bunch of ObjectIDs that have null id values. These null values start from ObjectID 20866 to 21899. ObjectID 20865 has id value 30542 so the next id value for ObjectID 20866 would be 30543 and then so on till ObjectID 21899.

How can I do this using Python in Calculate Field using a For loop and may be a ++ counter?

I am using ArcGIS Pro 3.1.1.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 27, 2023 at 18:30
6
  • 1
    Just select the null rows, then use field calculator and make the expression: !objectid! + 9677. Commented Oct 27, 2023 at 18:33
  • Nice thanks for the super quick response, so what's 9677 doing? Commented Oct 27, 2023 at 18:33
  • 1
    It's the difference between 30542 and 20865. Commented Oct 27, 2023 at 18:35
  • Wait don't you think instead of !objectid! it should be !id! since the first calculated id value will be 1 + 30542 where 30542 is the last id value before the null id values start? Commented Oct 27, 2023 at 18:37
  • 2
    No. You should use field calculator on the ID field. The expression will be ID = !objectid! + 9677. Commented Oct 27, 2023 at 18:39

1 Answer 1

2

Select the rows where ID is null, then you can use the field calculator on the ID field with the expression !objectid! + 9677 since 9677 is the difference in value of your OBJECTID and ID fields.

answered Oct 27, 2023 at 18:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.