szgraggen

conditional Update

Discussion created by szgraggen on Sep 11, 2012
Latest reply on Sep 11, 2012 by fabl
Hello
I am trying to update rows, it is conditioned on the previous row. I am stuck that, I can't assign a new value to a variable in a elseif statement:

rows = arcpy.UpdateCursor("LinienEndpunkte")


prevObjektNr = 1
prevRouteNr = 0
prevGewaesserKM = 0
currentObjektNr = 0
currentRouteNr = 0
currentGewaesserKM = 0

for row in rows:

    if prevObjektNr == 0:
        prevObjektNr = row.LinienObjektNr
        prevRouteNr = row.RouteNr
        prevGewaesserKM = row.Gewaesser_KM
    elif prevObjektNr == 1: #else:
        currentObjektNr = 7 #row.LinienObjektNr
        currentRouteNr = row.RouteNr
        row.Punktart = "Ende"
        rows.updateRow(row)
         if currentObjektNr == prevObjektNr:
         if currentRouteNr == prevRouteNr:
         if currentGewaesserKM > prevGewaesserKM:
            row.Punktart = "Ende"
            rows.updateRow(row)
            prevObjektNr = row.LinienObjektNr
            prevRouteNr = row.RouteNr
            prevGewaesserKM = row.Gewaesser_KM


Thanks for your help.

Outcomes