漏洞
漏洞 ID 编号 | BUG-000157802 |
---|---|
已提交 | April 25, 2023 |
上次修改时间 | June 5, 2024 |
适用范围 | ArcGIS Pro |
找到的版本 | 3.1.1 |
操作系统 | Windows OS |
操作系统版本 | 10.0 64 Bit |
修正版本 | 3.2, 3.1.3 |
状态 | Fixed |
The following Python script works to enable the editor tracking fields to be append and match the source dataset:
######################################
import arcpy
source = <link to source data>
target = <link to target data>
arcpy.env.preserveGlobalIds = True # can comment out this line if data does not have GlobalIds or if do not wish to preserve GlobalIds
arcpy.TruncateTable_management(target)
myFieldMappings = arcpy.FieldMappings()
myFieldMappings.addTable(target)
for fmi in range(myFieldMappings.fieldCount):
fm = myFieldMappings.getFieldMap(fmi)
for targetfield_index in range(fm.inputFieldCount):
intable = fm.getInputTableName(targetfield_index)
if intable == arcpy.Describe(target).catalogPath:
fm.removeInputField(targetfield_index)
myFieldMappings.replaceFieldMap(fmi, fm)
break
for fmi in range(myFieldMappings.fieldCount):
fm = myFieldMappings.getFieldMap(fmi)
targetFieldName = fm.outputField.name
sourceFieldList = arcpy.ListFields(source,targetFieldName)
for f in sourceFieldList:
if (len(sourceFieldList)) > 0:
sourceField = sourceFieldList[0]
newFMap = arcpy.FieldMap()
newFMap.addInputField(source,sourceField.name)
myFieldMappings.replaceFieldMap(fmi, newFMap)
arcpy.Append_management(source, target, "NO_TEST", myFieldMappings)
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序