UpdateCursor Variable Syntax

513
2
Jump to solution
06-04-2012 11:31 AM
AlanToms
Occasional Contributor
Hello All,

I am working on a script with an updatecursor and running into a syntax problem???I think.  My variables are hardcoded at this time, till I get it working.  The feature class and field to update are variables.  I think line row.inputField = 6 is where I believe I have the problem; line row.LinkID = 5 does work as LinkID is a field name.  It is looking for a field by the name of inputField instead of a variable.  I'm sure it is something simple.  Anyone have a suggestion?

Thank you for the help.
Alan


import arcgisscripting  # Create the Geoprocessor object gp = arcgisscripting.create(9.3)  # Input Variables inputFC = r"C:\GIS_Work\Temp.gdb\Subs" inputField = "LinkID"  cur = gp.UpdateCursor(inputFC) row = cur.Next() while row:     #row.LinkID = 5     row.inputField = 6         cur.UpdateRow(row)     row = cur.Next()     print "Value Added"          print "UpdateCursor Works"
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MathewCoyle
Frequent Contributor
What you want is this. Not sure of the exact syntax for 9.3 might be row.SetValue(...)
row.setValue(inputField,6)

View solution in original post

0 Kudos
2 Replies
MathewCoyle
Frequent Contributor
What you want is this. Not sure of the exact syntax for 9.3 might be row.SetValue(...)
row.setValue(inputField,6)
0 Kudos
AlanToms
Occasional Contributor
Wow total brain lock on my part.  Thanks for the help.
Alan


What you want is this. Not sure of the exact syntax for 9.3 might be row.SetValue(...)
row.setValue(inputField,6)
0 Kudos