I have a code in which I'd like a da.UpdateCursor, I have probles with the "where clause", here I am about to use a variable that I get from
arcpy.Describe. I have no idea of this even possible.
My code is:
newValue = arcpy.GetParameterAsText(0) inlyrdsc = arcpy.Describe("layertoedit") inFID = inlyrdsc.FIDset num = inFID.split("; ") inlayer = arcpy.mapping.Layer("layertoedit") query = "[OBJECTID] = %s", (num) fieldName = "fieldtoupdate" with arcpy.da.UpdateCursor(inlayer, (fieldName,), query) as cursor: for row in cursor: row = newValue cursor.updateRow(row)
I get the following error message:
TypeError: 'where_clause' is not a string
Anyways my goal is to write a script which fills the attribute table of the selected element (the selection is described by the OBJECTID). This might not be the best solution so any ideas are welcomed.