As part of our organization's transition to Pro, I'm finally beginning to write out our Attribute Rules, and I'm running into a weird conundrum with generating unique IDs.
I have a test database sequence created called "PipeTestingID":
And I have a simple Attribute Rule that calls that sequence to generate a test ID:
When creating new features, everything works fine. I get my test IDs and all is working exactly as I'd expect:
Except when I split the line:
We've skipped TestID-2. And if I do a more complex split that generates more child features, every segment except the largest will do this double-ID jump.
The ideal intended behavior should be that the longer part (Segment A, in this case) retains its ID. The shorter part (Segment B, in this case) should get a new unique ID and not skip IDs. I could compromise on both segments being given a new ID, but I'd prefer Segment A retain its ID.
Near as I can tell from some testing at the end of last week, I'm assuming the split operation consists of an Update operation on the geometry of the original feature (which is shortened to Segment A) and an Insert operation for the remaining portion (Segment B).
I tried setting the rule to trigger on Update as well and writing some logic in to avoid overwriting existing IDs, but most either didn't trigger when that logic was included or triggered every time I so much as changed a diameter when the logic was excluded. Unfortunately, I mistakenly didn't save that code, so I can't post it here without going back down the rabbit hole.
This seems like a fairly straightforward operation and a fairly straightforward requirement. What am I missing?
Edit:
I went back to 2.9.11/ 3.1/3.2 and I'm getting the correct behavior (split only generates one sequence)
Make sure when you test, create a new line feature, then do the split. this will generates a new sequence number for the line, but then the split will use the next value.
If you discard the edits the sequence is not returned (will be burned)
Try this:
var ID = $feature.NewID //Change to whichever id field
var CurrentLength = $feature.Shape_Length// Change to length field
var IDField = 'NewID'
if ( IsEmpty( ID ) ){ ID = 1000 }// Specify starting id value
var SQLFilter = IDField + ' = '
var CompareMatchLen = Max( Filter( $featureset , SQLFilter ) , 'Shape_Length' )
if ( CurrentLength <= CompareMatchLen ){ ID = max( $featureset , IDField ) + 1 }
console( ID )
return ID
This works in version 10.9.1. for Enterprise and 2.8 for Pro.