Is there a way to automate the 'Add new to Relationship' to create a new related record in ArcPro using python? Thanks. - Tom

811
2
Jump to solution
04-01-2019 05:20 AM
ThomasMakibbin
New Contributor

We are moving from a flat table structure where the inspection were part of the feature class to a new structure using a related table to record the inspections details. I copied the point locations into our new dataset containing the new point feature class and the relationship class and I preserved the global IDs so I can do a join to transfer the inspection data. 

I can't find a way to copy or append the data into the related table where it will allow me to put the parent globalID into the related table's foreign key's GUID field. The only way it lets me create the related record is to manually create the relationship by selecting the feature and then right-clicking and using the  'Add new to relationship' option.  Then I can do the join and transfer the inspection data to the correct fields.  The problem is that I have thousands of records!!!  There must be an easier way!!!  Please help... regards - Tom

1 Solution

Accepted Solutions
ThomasMakibbin
New Contributor

I found that if I delete the relationship class first and import the data, it allows me to add the parent GlobalID into the Foreign Key of the related table.  I can then add the relationship class to relate the parent and child records.

View solution in original post

2 Replies
ThomasMakibbin
New Contributor

I found that if I delete the relationship class first and import the data, it allows me to add the parent GlobalID into the Foreign Key of the related table.  I can then add the relationship class to relate the parent and child records.

BertKraan1
Occasional Contributor III

Hello Thomas,

Can you explain that in some more detail please? I can append data from the source table in my new feature class, including GlobalID but then what? Thank you for your time.

Bert

edit: Got it!

first, if nessecary copy the feature class into your own gdb (I overlooked that first)

append data to the (soon to be related table) 'Use the field map to reconcile schema differences' option for schema type and make sure to map globalid to the ID guid in your table

create the relationship class

delete extraneous fields in the feature class now present (and related) in the table.

Thank you and have a great day!

Bert

0 Kudos