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?
-
1Have you thought about using an update cursor to iterate through your rows and calculate your new field that way?Jason Bellino– Jason Bellino2011年07月27日 14:33:58 +00:00Commented Jul 27, 2011 at 14:33
-
2I'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– Nathanus2011年07月27日 15:37:41 +00:00Commented Jul 27, 2011 at 15:37
1 Answer 1
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.
Explore related questions
See similar questions with these tags.