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

Hi,

 

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:

http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000004m000000

 

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?

 

Cheers

Outcomes