Related Record Foreign Key

825
4
Jump to solution
04-24-2013 01:04 PM
TravisBock1
New Contributor II
When adding a new related record using the Edit widget the foreign key is not auto-populated. 

For example I have a feature with a primary key.  I click on the feature to get the edit popup and click the related records link at the bottom.  Then, after clicking Add New Record, I am presented with the inputs for that table.  Included is the foreign key field which is blank.  It seems to me two things should happen.  1) The foreign key field should be auto populated with the current features primary key.  2)The foreign key field should be hidden.  The second one I haven't attempted but I believe its relatively straight forward.  But the first part I am surprised about. 

So, am I missing something or the widget is not operating correctly.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
SarthakDatt
Occasional Contributor III
Would it be possible to share the JSON for relationships for both the layer and its related table.

I looked into the code and the RelationshipInspector does try to populate the foreign key but I think right now it assumes the key field name to be the same in both the layer and related table. My guess is that in this case the two fields are different.

View solution in original post

0 Kudos
4 Replies
VickyS
by
Occasional Contributor
I have the same issue. Any ideas ESRI?

Vicky
0 Kudos
SarthakDatt
Occasional Contributor III
Would it be possible to share the JSON for relationships for both the layer and its related table.

I looked into the code and the RelationshipInspector does try to populate the foreign key but I think right now it assumes the key field name to be the same in both the layer and related table. My guess is that in this case the two fields are different.
0 Kudos
TravisBock1
New Contributor II
This is a new geodatabase still in the dev phase.  So changing the key field names is not an issue.  I have already done so.  So now the primary key in the feature class matches the foreign key field name in the related tables and it is now working correctly. 

Thanks for the help! 

Maybe it is just me but it seems like this should be explained somewhere.  Or did I just miss it?

Travis
0 Kudos
SarthakDatt
Occasional Contributor III
I have already done so. So now the primary key in the feature class matches the foreign key field name in the related tables and it is now working correctly.


You shouldn't be required to do it. This would be a workaround for now. I will put in a fix for the next version.
0 Kudos