AnsweredAssumed Answered

Help with update cursor syntax

Question asked by jplay on Oct 2, 2012
Latest reply on Oct 3, 2012 by curtvprice
I need to subtract one field from another with one of the two fields being a variable.

Example:
[HTML]BuildingJoin = arcpy.GetParameterAsText(0)
DEPTHFIELD = arcpy.GetParameterAsText(1) # Field from BuildingJoin

curs = arcpy.UpdateCursor(BuildingJoin)
expr = '"'+DEPTHFIELD+'"'
for row in curs:
    val = row.getValue(expr)
    if val == None:
        row.setValue("SLOSH", 0)
    else:
        row.SLOSH = row.FFE - row.SURGE90
    curs.updateRow(row)[/HTML]

However, the "SURGE90" field needs to be a variable, i.e the DEPTHFIELD . For the life of me I can't figure out the syntax. Could someone help me out?

Outcomes