0

I need to run the append tool in an edit session because the feature class I am appending to is in a gdb with a relationship class, and I need to update the field mapping for a few of the fields. I created my Append tool using ModelBuilder to get the "field_mapping" correct.

I created this code and it seems to work okay, however, when I incorporate it into my longer field (with this being the last step) it no longer updates the fields... However, no error seems to occur either.

Import arcpy module here
import arcpy
arcpy.env.overwriteOutput = True

# Script Arguments
Fitting = arcpy.GetParameterAsText(0)
Final_Layer = arcpy.GetParameterAsText(1)
Out_Workspace = arcpy.GetParameterAsText(2)

edit = arcpy.da.Editor(Out_Workspace)
edit.startEditing(False, True)

# Process: Append
arcpy.Append_management(Final_Layer, Fitting, "NO_TEST", "ANCILLARYROLE \"AncillaryRole\" true true false 2 Short 0 0 ,First,#;ENABLED \"Enabled\" true true true 2 Short 0 0 ,First,#;EDITEDBY \"Edited By\" true true false 64 Text 0 0 ,First,#,Final_Layer,W_Valve_EDITEDBY,-1,-1;DATEEDITED \"Date Edited\" true true false 8 Date 0 0 ,First,#,Final_Layer,W_Valve_DATEEDITED,-1,-1;PLACEDBY \"Placed By\" true true false 64 Text 0 0 ,First,#,Final_Layer,W_Valve_PLACEDBY,-1,-1;DATEPLACED \"Date Placed\" true true false 8 Date 0 0 ,First,#,Final_Layer,W_Valve_DATEPLACED,-1,-1;LABELTEXT \"Label Text\" true true false 64 Text 0 0 ,First,#;WATERTRACEWEIGHT \"Water Trace Weight\" true true false 4 Long 0 0 ,First,#;SYMBOLROTATION \"Symbol Rotation\" true true false 8 Double 0 0 ,First,#;IPID \"IPID\" true true false 4 Long 0 0 ,First,#,Final_Layer,Count_One_IPID,-1,-1;SUBTYPECD \"Subtype Code\" true true false 4 Long 0 0 ,First,#,Final_Layer,Count_One_SUBTYPECD,-1,-1;NOMINALSIZE \"Nominal Size\" true true false 8 Double 0 0 ,First,#;MATERIAL \"Material\" true true false 10 Text 0 0 ,First,#;BRANCHSIZE \"Branch Size\" true true false 8 Double 0 0 ,First,#;DEGREES \"Degrees\" true true false 8 Double 0 0 ,First,#;FRAMME_BASENAME \"FRAMME_BASENAME (FRAMME Tag)\" true true false 20 Text 0 0 ,First,#;FRAMME_IPID \"FRAMME_IPID (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_PRMRY \"FRAMME_RB_PRMRY (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_SCNDRY \"FRAMME_RB_SCNDRY (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_FSC \"FRAMME_RB_FSC (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_STATE \"FRAMME_RB_STATE (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_COMPONENT \"FRAMME_RB_COMPONENT (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;FRAMME_RB_OCCURRENCE \"FRAMME_RB_OCCURRENCE (FRAMME Tag)\" true true false 8 Double 0 0 ,First,#;GPSX \"GPS X Coordinate\" true true false 8 Double 0 0 ,First,#;GPSY \"GPS Y Coordinate\" true true false 8 Double 0 0 ,First,#;GPSYESNO \"GPS Yes/ No\" true true false 255 Text 0 0 ,First,#", "Plug")

edit.stopEditing(True)

The only difference between this snippet and my larger script, is that my larger script has different parameters, the "Final_Layer" is actually created in the script rather than being an input... But I don't think that would make much of a difference.

Is there a reason the "editing" session is not kicking in during m larger model?

Or is it related to what I have here?

  • What layer are you intending to update the fields? From you snippet it is 'Fitting'. Is that correct? – jbalk Aug 2 '17 at 2:01
  • Have you set merge rules in your field mapping? – jbalk Aug 2 '17 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy