1

I am using ArcGIS 10.3 version in desktop. I wanted to assign landuse names (Landuse_04 column) based on the codes those are in my attribute table as the column ID_MAP. once I am done with editing the script in python, field calculator, this dialogue box is appearing! I do not have any idea about python or programming just worked on a prepared script.

Does anyone know why is this occurring?

enter image description here

1

It looks like you put the defined function into the returned field. The message says if you have multi-line you have to cut the code and activate the Show codeblock and paste the code into the "Pre-Logic" Script Code space. The last line should be used to return the defined function exist in the "Pre-Logic" Script Code.

Check "Using code blocks" in the Calculate Field examples for more information.

Here is a code snippet from the above help

Code Block:
def Reclass(WellYield):
    if (WellYield >= 0 and WellYield <= 10):
        return 1
    elif (WellYield > 10 and WellYield <= 20):
        return 2
    elif (WellYield > 20 and WellYield <= 30):
        return 3
    elif (WellYield > 30):
        return 4


Expression:
Reclass(!WELL_YIELD!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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