7

I have parcel and buildings layers.

In their attribute tables I want to replace "NULL" values with numbers from 1 to 2000, in "Parcel ID", or "Building ID" field.

How can I do this in ArcGIS Desktop?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 17, 2012 at 20:46

1 Answer 1

10

Here is a code block for the Field Calculator that will do what you require.

  1. Open the attribute table
  2. Select all of the records that contain a NULL value in the desired field
  3. Open up the Field Calculator and insert this code in the appropriate sections.

Accumulative and sequential calculations
Calculate a sequential ID or number based on an interval.

Expression:
autoIncrement()
Expression Type:
PYTHON_9.3
Code Block:
rec=0
def autoIncrement():
 global rec
 pStart = 1 #adjust start value, if req'd 
 pInterval = 1 #adjust interval value, if req'd
 if (rec == 0): 
 rec = pStart 
 else: 
 rec = rec + pInterval 
 return rec

This code sequence is taken from the ArcGIS 10.0 Desktop Help: Calculate Field Examples

I would highly recommend that you browse through the help documentation in that file and in the other help sections for ArcGIS, as there are many useful examples and code samples to pull from.

Enter the code above, into the Field Calculator as shown in the screen shot below: You would enter the code into the sections as detailed below:

  1. Choose Python as the Parser
  2. Pre-Logic Script Code: Enter code listed under Code Block
  3. Under the field name, in this case, RD20FULL =: Enter code listed under Expression
  4. Press OK

Example Field Calculator Code Entry

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Aug 17, 2012 at 22:20
0

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.