FROM ESRI 10/08/2010:"Running an update cursor on a feature layer that contains in-memory tabular joins created using the AddJoin tool is not supported (in v9.3.1 or v10.0). Instead, use the JoinField tool or the CalculateField tool's VB expression."Yarrr...Seems that if you were intent on not using what ESRI recommends, use a searchcursor store the "look up" values in a Python Dictionary (in memory), and then use an updatecursor on the main table and access the values stored in the dictionary.For example:#Defines the inputs
sourceTable = gp.GetParameterAsText(0)
destinationTable = gp.GetParameterAsText(1)
sourceKey = gp.GetParameterAsText(2)
destinationKey = gp.GetParameterAsText(3)
sourceField1 = gp.GetParameterAsText(4)
destinationField1 = gp.GetParameterAsText(5)
sourceField2 = gp.GetParameterAsText(6)
destinationField2 = gp.GetParameterAsText(7)
sourceField3 = gp.GetParameterAsText(8)
destinationField3 = gp.GetParameterAsText(9)
#Process: Print out the input parameters
message = "INPUT PARAMETERS"; showPyMessage()
message = "----------------"; showPyMessage()
message = "Source Table = " + sourceTable; showPyMessage()
message = "Destination Table = " + destinationTable; showPyMessage()
message = "Source Key = " + sourceKey; showPyMessage()
message = "Destination Key = " + destinationKey; showPyMessage()
message = "Source Field #1 = " + sourceField1; showPyMessage()
message = "Destination Field #1 = " + destinationField1; showPyMessage()
message = "Source Field #2 = " + sourceField2; showPyMessage()
message = "Destination Field #2 = " + destinationField2; showPyMessage()
message = "Source Field #3 = " + sourceField3; showPyMessage()
message = "Destination Field #3 = " + destinationField3 + "\n"; showPyMessage()
#Do some error checking
message = "Running error checks..."; showPyMessage()
#Process: Makes sure sourceTable exists
if gp.exists(sourceTable) != True:
message = "ERROR: " + sourceTable + " does not exist! Exiting script..."; showPyError(); sys.exit()
#Process: Makes sure the sourceKey and sourceField1 fields exist in sourceTable
fieldList = gp.listfields(sourceTable)
fieldNameList = []
for field in fieldList:
fieldNameList.append(field.name)
if sourceKey not in fieldNameList:
message = "ERROR: " + sourceKey + " field does not exist in " + sourceTable + "! Exiting script..."; showPyError(); sys.exit()
if sourceField1 not in fieldNameList:
message = "ERROR: " + sourceField1 + " field does not exist in " + sourceTable + "! Exiting script..."; showPyError(); sys.exit()
#Process: Makes sure destinationTable exists
if gp.exists(destinationTable) != True:
message = "ERROR: " + destinationTable + " does not exist! Exiting script..."; showPyError(); sys.exit()
#Process: Makes sure the destinationKey and destinationField1 fields exist in destinationTable
fieldList = gp.listfields(destinationTable)
fieldNameList = []
for field in fieldList:
fieldNameList.append(field.name)
if destinationKey not in fieldNameList:
message = "ERROR: " + str(destinationKey) + " field does not exist in " + destinationTable + "! Exiting script..."; showPyError(); sys.exit()
if destinationField1 not in fieldNameList:
message = "ERROR: " + str(destinationField1) + " field does not exist in " + destinationTable + "! Exiting script..."; showPyError(); sys.exit()
#Process: Figure out what fields we need for the search cursor
searchCurFieldListString = sourceKey + ";" + sourceField1
#Process: Builds a dictionary of the sourceTable's sourceKey field values
message = "Building source dictionary..."; showPyMessage()
sourceDict = {}
searchRows = gp.searchcursor(sourceTable,"","",searchCurFieldListString)
searchRow = searchRows.next()
while searchRow:
sourceKeyValue = str(searchRow.getvalue(sourceKey)) #ensure the key is a string!
sourceDict[sourceKeyValue] = searchRow.getvalue(sourceField1)
searchRow = searchRows.next()
del searchRow
del searchRows
#Process: Figure out what fields we need for the update cursor
updateCurFieldListString = destinationKey + ";" + destinationField1
#Process: Updates the destinationTable
message = "Updating destination table..."; showPyMessage()
updateRows = gp.updatecursor(destinationTable,"","",updateCurFieldListString)
updateRow = updateRows.next()
while updateRow:
destinationKeyValue = str(updateRow.getvalue(destinationKey)) #ensure the key is a string!
if destinationKeyValue in sourceDict:
updateRow.setvalue(destinationField1, sourceDict[destinationKeyValue])
updateRows.updaterow(updateRow)
else:
pass
updateRow = updateRows.next()
del sourceDict
del updateRow
del updateRows