arcpy.MakeFeatureLayer_management(FC, "FC_lyr") FC_lyr = "FC_lyr" arcpy.AddJoin_management(FC_lyr, "joinField", joinedFCTable, "joinField") fields =("{}.DataField".format(FC_lyr), "{}.OtherDataFiedl".format(joinedFCTable)) where = '"{}.OBJECTID" IS NOT NULL'.format(joinedFCTable) with arcpy.da.UpdateCursor(FC_lyr, fields, where) as rows: for row in rows: row[0] = row[0] + row[1]
Solved! Go to Solution.
lutTbl = "New_Shapefile2" targetTbl = "New_Shapefile" lutDict = dict([(r[0], (r[1], r[2])) for r in arcpy.da.SearchCursor(lutTbl, ["ID","value","value2"])]) updateRows = arcpy.da.UpdateCursor(targetTbl, ["ID","value","value2"]) for updateRow in updateRows: joinFieldValue = updateRow[0] updateRow[1] = updateRow[1] + lutDict[joinFieldValue][0] #assuming these values are numeric and not strings or anything! updateRow[2] = updateRow[2] * lutDict[joinFieldValue][1] #assuming these values are numeric and not strings or anything! updateRows.updateRow(updateRow) del updateRow, updateRows
slopeDict = {} searchRows = arcpy.da.SearchCursor(slopePctZoneStatTbl, ["VALUE","MIN","MAX","MEAN"]) for searchRow in searchRows: keyValue = searchRow[0] minValue = searchRow[1] maxValue = searchRow[2] meanValue = int(searchRow[3] + .5) slopeDict[keyValue] = (minValue, maxValue, meanValue) del searchRow, searchRows
updateRow[1] = updateRow[1] + joinDict[joinFieldValue][0]
arcpy.AddMessage(joinDict[joinFieldValue][0])
arcpy.AddMessage(joinDict[4220][0])
updateRow[1] = int(updateRow[1]) + int(joinDict[joinFieldValue][0])
arcpy.AddMessage(joinDict[joinFieldValue][0])
arcpy.AddMessage(int(joinDict[joinFieldValue][0]))
{4931: (1466.31859047, 0.7298187853203999, 0.181307540288, 0.0, 0.0, 0.0, 0.0, 0.0, 1.45650000000222, 280800.0, 266454.070051103, 0, 3, 2524.95936472164, 312.0, 1303.0, 214200.0, 72900.0, 0)}
Here's a line of it:{4931: (1466.31859047, 0.7298187853203999, 0.181307540288, 0.0, 0.0, 0.0, 0.0, 0.0, 1.45650000000222, 280800.0, 266454.070051103, 0, 3, 2524.95936472164, 312.0, 1303.0, 214200.0, 72900.0, 0)}