01e38acffe
.
any ideas?
Tks
A:
You can do something like this. The basic idea is to have a table of all available pairs of entries, then update them both whenever one changes.
import arcpy, sys
from arcpy.sa import *
def getPairs(wFld1, wFld2):
pairList = list()
fields = arcpy.ListFields(wFld1)
for field in fields:
fieldList = arcpy.ListFields(wFld2, field.name)
for field in fieldList:
pairList.append((field.name, field.name))
return pairList
def updateMatchingFields(wFld1, wFld2, f1, f2):
fieldList = [f1.name, f2.name]
for field in fieldList:
arcpy.AddFieldDelimiters(wFld1, field)
arcpy.UpdateField(wFld1, field, f2.value)
arcpy.DeleteField(wFld1, field)
arcpy.AddFieldDelimiters(wFld2, field)
arcpy.UpdateField(wFld2, field, f1.value)
arcpy.DeleteField(wFld2, field)
with arcpy.da.UpdateCursor(wFld1,'match_fltr', ('', wFld2.name)) as rFld:
for wFld1, wFld2 in rFld:
f1 = getPairs(wFld1, wFld2)
if f1:
f1 = f1[0]
f
Related links:
Comments