I have a Field Calculator I am using with Python and I keep getting the above error. Below is the screenshot of my Field Calculator I am using.
What am I doing wrong here?
Answer
You are confusing the scope when defining your function and its arguments in the pre-logic script. An actual field cannot be within the definition of the function in the pre-logic script. See screen shot of a working field calculator function:
Notice how temp is defined as an argument in the pre-logic script code and keeps its name when used inside the function. Then in the JanClass = block I use the function and define which field values I want to use.
So in your case add another argument to your function, call it objectID, and then when you call your function in the box below feed it !OBJECTID!. Additionally I am fairly certain that OBJECTID cannot be used in field calculator operations. If you are trying to do an auto increment function refer to the answer given by adouxju on this question - (How to auto increment a field in a feature class?).
No comments:
Post a Comment