AnsweredAssumed Answered

Join AGOL hosted feature layer to feature class

Question asked by edward.glover_onegis on Sep 8, 2019

In attempting to join a feature class to a hosted feature layer to determine if there are features that exist in the feature class and not in the hosted feature layer (see code below), I get the following error.

ERROR 000732: Join Table: Dataset fl does not exist or is not supported
Failed to execute (AddJoin).

 

How can I join a hosted feature layer to a feature class?

 

publishedWebLayer = r"https://services1.arcgis.com/mapid/ArcGIS/rest/services/FeatureServer/1"
mygis = arcgis.gis.GIS(r"https://maps.arcgis.com", "usr", "pw")
fl = arcgis.features.FeatureLayer(publishedWebLayer, mygis)
FC = r"C:\GIS\Data.gdb\BRW3"

arcpy.MakeFeatureLayer_management(FC, "fcView")
joinField = "UID"
arcpy.AddJoin_management ("fcView", joinField, "fl", joinField, "KEEP_ALL")
arcpy.SelectLayerByAttribute_management("fcView","NEW_SELECTION",'"Incidents.OBJECTID" IS NULL')

Outcomes