import arcpy from arcpy import env env.overwriteOutput = True # Local variables: SOIL_P_TERR_Spatial = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SOIL_P_TERR_Spatial" SO_SOILSCHEM_T = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOILSCHEM_T" SO_SOIL_P = "Z:\\ESRI\\Geodatabase\\Test1.gdb\\SO_SOIL_P" v_smu = "\"smu\"" v_spatial_ = "\"spatial\"" soiltable = "soiltable" v_smu2 = "\"smu\"" arcpy.AddIndex_management(SO_SOIL_P, "SITE;SITE_ID;LOCATION;LSD", "SO_SOIL_P_index", "NON_UNIQUE", "ASCENDING") # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(SO_SOIL_P, v_smu) # Process: Add Join arcpy.AddJoin_management(v_smu, "SITE_ID", v_spatial_, "SITE_ID", "KEEP_ALL") # Process: Make Table View arcpy.MakeTableView_management(SO_SOILSCHEM_T, soiltable) # Process: Add Join (2) jointables = arcpy.AddJoin_management(v_smu2, "SO_SOIL_P.SITE_ID", soiltable, "SITE_ID", "KEEP_ALL") fieldList = arcpy.ListFields(jointables) # This prints all the fields in the above joins successfully. for field in fieldList: print field.name rows = arcpy.SearchCursor(jointables) for row in rows: # This will print the unicode row print row # This print will error out, saying the field doesn't exist, but in the field list about, it does print row.SO_SOIL_P.OBJECTID # I get the same error when I try this as well print row.OBJECTID
Solved! Go to Solution.
>>> fc = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Transportation\Streets" >>> table = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Streets_DailyProfiles" >>> featLyr = arcpy.MakeFeatureLayer_management(fc) >>> tblView = arcpy.MakeTableView_management(table) >>> arcpy.AddJoin_management(featLyr, "ID", tblView, "NETWORK_ID") <Result 'Streets_Layer'> >>> rows = arcpy.SearchCursor(featLyr) >>> row = rows.next() >>> row.getValue("Streets.ID") 78400003854190.0 >>> row.getValue("Streets_DailyProfiles.NETWORK_ID") 78400003854190.0
print row.getValue("OBJECTID")
print row.getValue("SITE_ID")
print row.getValue("SO_SOILSCHEM_T.SITE_ID)
>>> fc = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Transportation\Streets" >>> table = r"C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Streets_DailyProfiles" >>> featLyr = arcpy.MakeFeatureLayer_management(fc) >>> tblView = arcpy.MakeTableView_management(table) >>> arcpy.AddJoin_management(featLyr, "ID", tblView, "NETWORK_ID") <Result 'Streets_Layer'> >>> rows = arcpy.SearchCursor(featLyr) >>> row = rows.next() >>> row.getValue("Streets.ID") 78400003854190.0 >>> row.getValue("Streets_DailyProfiles.NETWORK_ID") 78400003854190.0