I am creating a customized script tool that first clips out a line feature from one feature class, dissolves the fields of the clipped feature class so that just one feature is in it, appends the dissolved feature to another feature class, and then updates certain fields with default values for this newly appended feature.
When I run either of the codes below, no errors are thrown, and everything through the appending step works as expected (Note: 'NO_TEST' is passed for schema type with the result being that the appended feature is 'Null' for all fields.) However, I can't get the fields to update; they stay as 'Null' for all fields.
At first, I was including a where clause to instruct the tool to update only those rows with null values in the LOC_UNCERT field to prevent the tool from updating every row every time and instead just the newly added feature. In the properties of the tool, I set the default for the strSQL (where clause) to LOC_UNCERT IS NULL. The code for this attempt looked like the following (with adjusted sys.argv numbering due to leaving out the first 3 steps):
fcAppend = sys.argv strSQL = sys.argv lstFields = ["LOC_UNCERT", "CONC_FEAT_", "UH_EX"] try: with arcpy.da.UpdateCursor(fcAppend, lstFields, strSQL) as cursor: for row in cursor: row = "Linear" row = "Point" row = "N" cursor.updateRow(row) except: print arcpy.GetMessages(2)
What I expected was that the LOC_UNCERT field would be updated to 'Linear', the CONC_FEAT_ field to 'Point', and the UH_EX field to 'N'. However, no fields are updated with this code.
So, I did some searching and saw this thread and tried taking out the where clause altogether and instead trying this:
fcAppend = sys.argv lstFields = ["LOC_UNCERT", "CONC_FEAT_", "UH_EX"] try: with arcpy.da.UpdateCursor(fcAppend, lstFields) as cursor: for row in cursor: if row == None: row = "Linear" row = "Point" row = "N" cursor.updateRow(row) except: print arcpy.GetMessages(2)
Again, I get no errors, but all fields are still blank after running this.
I am using ArcMap 10.3.