AnsweredAssumed Answered

Add selected to relationship programmatically

Question asked by connolm5 on Sep 24, 2020

Say I have (1) a polygon feature layer and (2) a point feature layer and a relationship class between the two. The points that lie in each polygon are related to that polygon.

 

For existing features, the standard way of creating the relationship is to select the polygon and points, right-click on the layer in the attributes pane and select "Add selected to relationship".

 

Is there a way to do this programatically? For example in Arcpy? Maybe using a point in polygon selection/query followed by something else?

 

There doesnt seem to be a way to add selected features to the relationship without having to physically click buttons which is time consuming and inefficient. The only way I can think to do it would be to run a point-in-polygon selection/query for each polygon, get the polygon key and then update the key for each feature in the points layer. Not very elegant but is this the only way?

Outcomes