1

I'm trying to make a simple field calculation with ArcGIS 9.3:

New field = Old field - Old field(first value)

which in Calculate Field with python code should be

Expression:

!Old field! - first

Code Block:

list= [AngOriz]
first = list[0]

The error is

ERROR 000539: Runtime error : name 'AngOriz' is not defined Failed to execute (Calculate Field).

How could I transform a column field into a list?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 27, 2011 at 14:25
2
  • 1
    Have you thought about using an update cursor to iterate through your rows and calculate your new field that way? Commented Jul 27, 2011 at 14:33
  • 2
    I'm having a bear of a time understanding this. Could you give us a sample of the data and explain what the calculation should result in if it works properly? Commented Jul 27, 2011 at 15:37

1 Answer 1

3

I'm not certain I understand the problem, but I asked a question here previously about the syntax when using the Python Codeblock. The key misunderstanding I had was that you need to pass in your field names as arguments to the code block. Here is a small example:

enter image description here

and the corresponding part of the attribute table:

enter image description here

In your case, I think the easiest thing would be to make a new field with the value from Old field(first value), and then use that for the calculation. This would not require putting python in the codeblock.

answered Jul 27, 2011 at 20:55

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.