Opening Related Tables in ModelBuilder

1227
3
11-23-2017 02:26 AM
ANNAPRIOR1
New Contributor II

Hi I was wondering if anyone know a way to open "Related Tables" in ModelBuilder. There doesn't seem to be a tool that does this so if anyone has any code it would be really useful. All the relationship classes tools seem to be to create a relationship rather than view them.

The aim of this part of the model is to automate the process of finding what polygons of one layer are not related another layer. Manually I would do the following:

Open attribute table > Click Related Table > Click on the layer I would like to see the relates of > switch selection.

I hope this makes sense.

Thanks

0 Kudos
3 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Your workflow of how you currently do it cannot be emulated using tools in arctoolbox which therefore limits your ability to do it in modelbuilder. Any functionality exposed in arcpy simply deals with updating existing elements within projects, for example http://pro.arcgis.com/en/pro-app/arcpy/mapping/arcgisproject-class.htm  None of which applies to your workflow.  

You could go back a step and use the Add Relate in your workflow, buy it is the switch selection that is the problem

0 Kudos
curtvprice
MVP Esteemed Contributor

Relates have always been an interactive workflow. However, I believe you can accomplish this workflow in Model Builder or Python as follows:

table1 - table you want to find no-matches in

table2 - table you are matching to

1) Add Join table1, join_table=table2. Use the same fields the relate uses. 

2) Select Layer By Attribute,  'table2.<joinfield> IS NULL'

3) Remove Join (table2)

The records without a match should be selected.

Tags (1)
BeckyC-O
New Contributor

This is a brilliant workflow!  You've effectively solved the Relate problem when using ModelBuilder.  THANK YOU!!!

0 Kudos