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 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[0] = newValue cursor.updateRow(row)I get the following error message:
TypeError: 'where_clause' is not a stringAnyways 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.
أكثر...
newValue = arcpy.GetParameterAsText 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[0] = newValue cursor.updateRow(row)I get the following error message:
TypeError: 'where_clause' is not a stringAnyways 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.
أكثر...