Auto Populate ID using Related Tables in Smart Editor

1523
3
Jump to solution
09-12-2018 09:37 AM
MRReddy
Occasional Contributor

I'm working with relation tables in smart editor, How to auto populate a field from parent table to related table

when a new feature is added in related tables, how to auto populate a value from previous window

andrescastillo08 

1 Solution

Accepted Solutions
AndresCastillo
MVP Regular Contributor

The easiest way I know how to do this is to make the relationship from a parent Global ID field, and a child GUID field in a one to many relationship.

Doing this will autofill the child GUID field with the parent's Global Id.

The smart editor widget should be set to only display, not edit, these fields.

·         See 'Related Data in ArcGIS' Blog post by Michael Kelly on geonet:

o   https://community.esri.com/people/MKellyesri-ireland-ie-esridist/blog/2016/11/18/related-data-in-arc...

This is my workflow:

Relationship Properties

·         Relate using 'have' as part of name.

·         Composite Relationship

o   Once asset is removed from the parent fc, related inspections are also removed.

§  Clients agreed that once an asset becomes abandoned, no need to keep inspection history about it

·         Origin FC to Destination table label: History

·         Destination table to Origin FC label: ssNameOfFC

·         select 'None' for the message direction.

·         1-M

·         No, I do not want to add attributes to this relationship class.

·         pk= GlobalID

·         FK= RELATEDGLOBALID

 

 

General Structure

·         FC

·         related to

·         Inspection History Table

·         via Parent Global ID, Global ID Data Type/Child RELATEDGLOBALID, Guid Data Type

·         relate to

·         Attachment table

·         via Parent Global ID, Global ID Data Type/Child RELATEDGLOBALID, Guid Data Type

View solution in original post

3 Replies
AndresCastillo
MVP Regular Contributor

The easiest way I know how to do this is to make the relationship from a parent Global ID field, and a child GUID field in a one to many relationship.

Doing this will autofill the child GUID field with the parent's Global Id.

The smart editor widget should be set to only display, not edit, these fields.

·         See 'Related Data in ArcGIS' Blog post by Michael Kelly on geonet:

o   https://community.esri.com/people/MKellyesri-ireland-ie-esridist/blog/2016/11/18/related-data-in-arc...

This is my workflow:

Relationship Properties

·         Relate using 'have' as part of name.

·         Composite Relationship

o   Once asset is removed from the parent fc, related inspections are also removed.

§  Clients agreed that once an asset becomes abandoned, no need to keep inspection history about it

·         Origin FC to Destination table label: History

·         Destination table to Origin FC label: ssNameOfFC

·         select 'None' for the message direction.

·         1-M

·         No, I do not want to add attributes to this relationship class.

·         pk= GlobalID

·         FK= RELATEDGLOBALID

 

 

General Structure

·         FC

·         related to

·         Inspection History Table

·         via Parent Global ID, Global ID Data Type/Child RELATEDGLOBALID, Guid Data Type

·         relate to

·         Attachment table

·         via Parent Global ID, Global ID Data Type/Child RELATEDGLOBALID, Guid Data Type

AndresCastillo
MVP Regular Contributor

If the Global ID is too large for end users, then I recommend the following in addition to that:

Add the ID field to both the parent and related child tables.

Use Attribute assistant (and generate id/dynamic value tables) to populate parent ID's.

join fc to child table by parent global id/child guid
select null asset id's in child table.
field calculate python
=
!Sanitary.SDE.ssParentFC.FACILITYID!
save edits
remove join

Additionally, you can script this to occur periodically, but ensure to
setloghistory to false to avoid making gdb objects slow over time.

http://desktop.arcgis.com/en/arcmap/10.4/analyze/arcpy-functions/setloghistory.htm

If you end up making the script, can you please post it here?

I have not made that script yet.

0 Kudos
AndresCastillo
MVP Regular Contributor

Addditionally, here are some other notes I took on my efforts that did not work for this purpose, but might be useful to some:

·         On create method:

·         Attrib assistant must be turned on.

·         On Create true, remainder false.

·         Since registered as versioned with moving edits to base, the newly created id and record from default is already available in all descendant versions without the need to reconcile.

·         Pending to test what happens when reconcile the default edits to descendants….does the on create create new id’s for the children?

·         The on create only works in default version, NOT any other version…..most likely because it was configured in default.

·         The on create only works in default version within the mxd, not from the front end application using the smart editor.

·         Field calculator ‘calculate unique id without attribute assistant.jpg’:

·         The string concatenation would add that number at the end of the string, such as SSO00009 then SSO000010.

o   Python

§  Pre-Logic Script Code:

·         counter = 0

def uniqueID():

 global counter

 counter += 1

 return “SSO” +(“0000”+ str(counter))

§  FACILITYID =

uniqueID()

 

·         CreateUniqueID’s tool:

o   Did not populate the XXXX part, and since it is a script, can’t be run on feature creation.

0 Kudos