I am using python to calculate fields with a SQL statement. I need to select based on two attributes and calculate another attribute. The way I am typing it is incorrect syntax.
This is a small portion of the code and will run on a specific feature class.
Here is the code:
codeblock = """def calcFerry(FERRY_TYPE,AR_AUTO): if(FERRY_TYPE == 'B') and (AR_AUTO == 'N') return 'P' elif(FERRY_TYPE == 'B') and (AR_AUTO == 'Y') return 'A'""" arcpy.CalculateField_management(outTemp_file, "FERRY", calcFerry(!FERRY_TYPE!,!AR_AUTO!)", "PYTHON", codeblock)