Hello everyone,
The following source code shows how to copy features from one feature class (Source) to another feature class (Destination) when both features are versioned.And then remove features copied from the Source
The steps:
versions = arcpy.ListVersions(database)
# Print the versions available to the user
for version in versions:
print(version)
if version == WorkingVersion:
# Execute DeleteVersion
arcpy.DeleteVersion_management(database, WorkingVersion)
# Execute CreateVersion
arcpy.CreateVersion_management(database, ParentVersion, WorkingVersion, "PUBLIC")
# Select records with STATUS = 'Completed' and Historical records
arcpy.MakeFeatureLayer_management(SourceFeatureCalss, SourceLayer, "STATUS = 'Completed'", "", " .....")
# Process: Make Feature Layer (2)
arcpy.MakeFeatureLayer_management(EditableFeatureClass, AppendedLayer, "", "", "......")
#
# Change Both layers SourceLayer and AppendedLayer To OWNER.WORKINGVERSION version
#
arcpy.ChangeVersion_management('SourceLayer','TRANSACTIONAL', WorkingVersion,'')
# Change to HISTORICALAASIS version
arcpy.ChangeVersion_management('AppendedLayer','TRANSACTIONAL', WorkingVersion,'')
# Process: Append...
arcpy.Append_management("SourceLayer", AppendedLayer, "TEST", "", "")
# Process: Delete Features...
arcpy.DeleteFeatures_management(SourceLayer)
arcpy.ReconcileVersions_management(database,
"ALL_VERSIONS",
"OWNER.ParentVersion",
"OWNER.WORKINGVERSION",
"LOCK_ACQUIRED",
"NO_ABORT",
"BY_OBJECT",
"FAVOR_TARGET_VERSION",
"POST",
"KEEP_VERSION",
scratchFolder + "RecLog.txt")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.