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?

2
  • 1
    Have you thought about using an update cursor to iterate through your rows and calculate your new field that way? 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?
    – Nathanus
    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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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