Attribute Rule to split and also copy from backup

180
0
04-03-2024 04:16 PM
DarrylKlassen1
Occasional Contributor II

Hello,

I am trying to write 1 or a series of attribute rules that populate my unqiueID in my feature class.  I have a sequence set up and I am trying to create the attribute rules that will follow these basic guidelines:

1. If I create a brand new feature - a new ID is calculated

2. If I split a feature (line or polygon) the longest or largest will maintain the existing ID, but the shortest or smaller feature will get a new ID

3. If I copy in 1 feature from a backup file - it will maintain the ID that I have in the backup file.  This is to mimic a scenario if we accidently delete a feature - we can recover it and maintain the original ID. 

The issue that I am having mainly is I can get the split OR the copy from backup to work, but not both using the same rule.

Eg. This works for new features and splitting features - but if I copy an old feature (that has a FacilityID value) in from a backup Feature Class, it gives it the next value.
var new_facid = "TP" + NextSequenceValue('myID')
return new_facid

OR

Eg. This works for new features and copying data in from a old feature (that has a FACILITYID value) from a backup Feature Class, but doesn't create a new values for the smaller area on a split.
if (IsEmpty($feature.FACILITYID)) {
var new_facid = "TP" + NextSequenceValue('myID')
} else {
var new_facid = $feature.FACILITYID
}
return new_facid

Has anyone had any success with a setup like this?

 

Thanks

Darryl

0 Kudos
0 Replies