Select to view content in your preferred language

Calculate Expression for Populating which Parent Layer a New Record in the Related Table was created from

307
2
02-20-2025 10:06 AM
Clubdebambos
MVP Regular Contributor

Hi all,

I have a two layers and one table. Both layers relate to the table (1:M). 

When I click on Layer_1, and then access the related table and click Add, is there any way to automatically populate a field that shows that the record in the table was created via Layer_1.

The same for Layer_2, click on the symbol for a geometry, access the related table and click Add, automatically populate a field showing that you added the record via Layer_2.

It is important to keep the two layers separate but the information being collected in the related table is the same.

Cheers,
Glen

 

~ learn.finaldraftmapping.com
0 Kudos
2 Replies
KerriRasmussen
Esri Contributor

Good afternoon. Can you create a second table for the second layer? I think that would be the simplest solution. Then, we you archive your data, you can do a field calculate on each table to show which layer they originate from and combine the two tables into one if needed or just keep them separate.

0 Kudos
RhettZufelt
MVP Notable Contributor

I have something similar where I have multiple featureclasses related to a single 'inspections' table.

I set them up as relationship class in Pro, and published to feature service.  However, to get things (popups, adds, etc.) to work properly, I ended up creating a separate GUID field for each FC in the Inspections Table.

So, layer1 and layer2 both have GlobalID field, and the Inspections table has a Layer1_GUID field, and a Layer2_GID field.  I then set up a relationship class with Layer1 GlobalID using the Layer1_GUID field as the Foreign key, Layer2 GlobalID using Layer2_GUID, and so on.

So, when I add new inspections, it will populate the Layers respective foreign key field with the GlobalID from the respective layer. 

This makes it very easy to 'see' what FC originated the inspection.

I actually want this is info a "SourceFC" field in the inspections table so I have a trigger on my data that when new feature is added, if the Layer1_GUID field is populated, update SouceFC = Layer1, If the Layer1_GUID field is populated, update SourceFC=Layer2, and so on.

Not sure if this will work for you, but might give you some ideas.

R_

0 Kudos