Select to view content in your preferred language

Select related records and definition query in an ArcGIS Pro Python Notebook

293
0
04-22-2025 08:19 AM
Labels (1)
JohnEsch2
Occasional Contributor

Question 1 Select related records in a Notebook

I have a many step ArcGIS Pro Python Notebook to format a layer (add fields, run calculations, make selection, populate field based on selection, clear selection, join a table, export feature…)

All of these are working fine in my Notebook, but one of the later steps is to add a relate from my main layer (layer1) to another layer (layer2), then make a selection on Layer1 (arcpy.management.SelectLayerByAttribute). I would like to then select related records in layer2. I can easily do this in Layer1 attribute table (Select Related Record), I can also manually for the Layer1 Selection tab under put a check in the box next to Automatically select related data. But I would rather have the select related records as another line in my Notebook. Is there an arcpy script available to select related records?

Question 2 Definition query on a layer in a Notebook

I have another ArcGIS Pro Python Notebook where I need to start out with a definition query on a layer, then a series of steps on that queried layer. I can easily manually create a definition query on the layer, then run the remaining steps of the Notebook. I would like to have the definition query on the layer as a step in the Notebook.

Thanks

0 Kudos
0 Replies