- I'm a little uncertain whether this question belongs here or on http://gis.stackexchange.com
Have an "AddJoin" that results in no shared records, which is not what I'm expecting. Is it because I'm using a text field for the join? Something else? I'm trying to do this on point features from featureclass layers in a file gdb and a shapefile (both expressed as TableViews) on which I've performed a arcpy.SelectLayerByAttribute_management(). No cursors are being used.
Thanks for any ideas. ArcGIS 10.0. Also, ArcMap crashes if I try a JoinField on the same fields.
>>> arcpy.GetCount_management("GagesII")
<Result '1'>
>>> for row in arcpy.SearchCursor("GagesII"):
... gageid=row.getValue("GAGE_ID")
...
>>> gageid
u'01170000'
>>> arcpy.GetCount_management("StreamGageEvent")
<Result '1'>
>>> for row in arcpy.SearchCursor("StreamGageEvent"):
... sourcefea=row.getValue("SOURCE_FEA")
...
>>> sourcefea
u'01170000'
>>> if gageid==sourcefea:
... print 'yes'
...
yes
>>>
>>> arcpy.AddJoin_management("GagesII", 'GAGE_ID', "StreamGageEvent", "SOURCE_FEA", "KEEP_COMMON")
<Result 'GagesII'>
>>>
>>> arcpy.GetCount_management("GagesII")
<Result '-1'>
Best Answer
You say:
My feeling is that if it cannot be done interactively then the issue is outside of ArcPy and you should look more closely at your data.
Perhaps try working on fresh copies of your feature class and shapefile and see whether they can be joined both via the layer's context menu (which will give you an option to validate the join) and the Join Field tool.