# Import arcpy module import arcpy arcpy.env.Overwriteoutput = True # Local variables: Stoat_Trap_Input = arcpy.GetParameterAsText(0) Stoat_Trap_Records = "Stoat Trap Records" stifl = "in_memory\\stifl" try: arcpy.MakeFeatureLayer_management(Stoat_Trap_Input, stifl, "Trap1 <>'Unchecked' OR Trap2 <>'Unchecked'") featurecount = arcpy.GetCount_management(stifl) print featurecount if not featurecount == 0: arcpy.AddMessage("Input layer " + Stoat_Trap_Input + " has " + str(featurecount) + " new\updated records.") arcpy.AddMessage("Adding " + str(featurecount) + " new\updated records to the main database.") arcpy.Append_management("in_memory\\stifl", Stoat_Trap_Records, "NO_TEST") arcpy.AddMessage(str(featurecount) + " new\updated records successfully added.") arcpy.CalculateField_management(stifl, "Trap1", "\"Unchecked\"", "PYTHON_9.3", "") arcpy.CalculateField_management(stifl, "Trap2", "\"Unchecked\"", "PYTHON_9.3", "") arcpy.RefreshActiveView() else: arcpy.AddMessage("Input layer " + Stoat_Trap_Input + " has no new updates. Records must be added\updated before they require processing.") except: msgs = arcpy.GetMessages(2) arcpy.AddError(msgs) arcpy.AddMessage(msgs) print msgs del arcpy
Solved! Go to Solution.