Relationship classes are great because they allow relationships between two datasets to persist between ArcMap sessions.
When dealing with relationships in scripts generally I create two separate loops in order to retrieve related records. The first loop iterates a spatial file's primary key, while a second, nested loop iterates on the tabular file's foreign key. A list of related records can be created where these two keys match.
An arcpy method that notes the relationship between the two datasets and allows the user to pull out related records more easily would be helpful. Perhaps the relationship class could be used as a parameter along with the two datasets since the relationship class already contains the logic for how the two datasets are related.
Still miss RESELECT KEYFILE in ArcPlot which would do a similar thing. Select records in table 1 and migrate that selection to another table through a pair of key files in the source and destination table, regardless of 1-M,M-1,or M-N cardinality. Workflows exist in geoprocessing but most are clunky.
Implementing this with relates would be very consistent and elegant and also allow the use of stored relationship classes and on the fly relationships created with Add Relate in Pro.
cc: management:
Subject: maybe y'all need to hire some more devs...
It's been six years since this idea was posted. It says it's been "reviewed" ... How is this not already a thing? It would be so useful and would be one of the first things I would think of when designing the CONCEPT of relationship classes.
...And come to think of it, I sincerely believe any reasonable person would want the ability to pull all related records with an arcpy function.
Case in point, I am building out our entire water treatment plant in ArcMap 10.6. We have well over a 1000 assets that need to be tracked. Some of the relationships are up to four levels deep, possibly more.
E.g.
TreatmentSystem [Polygon] -> ChemSystem [Table] -> NaOh [Table] -> AuxTank [Table] -> Analyzer
I'm happy to share that we're making progress on an ArcPy method for retrieving related records! This status does not guarantee that the functionality will be in the next release, but development work has begun. Release cycles vary by product so make sure to check the product life cycle information to get an idea of when to expect the next release.
This Idea has been implemented in ArcGIS Pro 3.2. Please see the What's New documentation for more new features in Pro 3.2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.