AnsweredAssumed Answered

ArcGIS Desktop Advanced 10.2 - Calculate Field with codeblock?

Question asked by Vincenty on Mar 3, 2015
Latest reply on Mar 4, 2015 by Vincenty



In ArcGIS Advanced for Desktop 10.2, I am trying to calculate a field "ELEV_METER" in a shapefile with an expression and code-block as here:


expression = "getElev(double(!ELEV!))" codeblock = """def getElev(elev):      if elev <> 0:           return !ELEV!"""  arcpy.CalculateField_management(fc, "ELEV_METER", expression, "PYTHON_9.3",codeblock)


trying to apply ressources from ESRI:


The calculate field should be done only if the field ELEV is not 0, then the if statment...


But is does not work! Any guess?