I'm currently away in a remote field station using Arc 10.0 and having a hard time using an inline variable substitution for a numeric field value. I am trying to use UpdateCursor to select only a specific line by designating a "POSITION" field = to a numeric value that I can increment each time I go through the for loop. When I use a number in the line, it works. However, I can't seem to get the right syntax to substitute the hard-coded number for a variable.
here's the section of code:
## Attempt to update the cursor, then get value, then setvalue using an inline variable for the desired Field value
## THIS does not work
stefile = "ste1.shp"
stefield = "POSITION"
steclus = "CLUSTER"
steac = "AC"
stevalue = 100
stepos = 22
Z = arcpy.UpdateCursor(stefile, '"POSITION" = stepos') # This needs to be changed eg; '"POSITION" = a memvar') ...and at end of loop memvar +=1
for row in Z:
print row.getValue(steclus)
memvar = row.getValue(steclus)
row.setValue(steac, stevalue)
Z.updateRow(row)
print row.getValue(steac)
del Z
del row
### HERE are the error messages
# Runtime error <type 'exceptions.RuntimeError'>: ERROR 999999:
# Error executing function.
# A column was specified that does not exist.
Am I simply using the wrong syntax? Or am I barking up the wrong tree?
Guidance and advice welcome. Thanks.