Select to view content in your preferred language

NextSequenceValue and Split Feature

915
3
04-01-2024 07:25 AM
MErikReedAugusta
MVP Regular Contributor

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":

MErikReedAugusta_0-1711980558575.png

And I have a simple Attribute Rule that calls that sequence to generate a test ID:

MErikReedAugusta_1-1711980605639.png

 

When creating new features, everything works fine.  I get my test IDs and all is working exactly as I'd expect:

MErikReedAugusta_2-1711980870803.png

Except when I split the line:

MErikReedAugusta_6-1711981272415.png

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?

------------------------------
M Reed
"The pessimist may be right oftener than the optimist, but the optimist has more fun, and neither can stop the march of events anyhow." — Lazarus Long, in Time Enough for Love, by Robert A. Heinlein
Tags (3)
0 Kudos
3 Replies
HusseinNasser2
Esri Contributor

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)

 

0 Kudos
GregJohnson4
New Contributor

I have essentially the same rule (slightly modified) utilizing nextsequencevalue set up for an asset id field on a feature class that has been published to our organization's enterprise portal.

Rule:

if (IsEmpty($feature.PIPE_ID)) {
return NextSequenceValue("sssewerline_id_sequence");
}
else {
return $feature.PIPE_ID;
}

When I edit the feature service in Pro 3.4, I am getting the same behavior of the sequence being triggered twice when the line is Split (original/larger line segment pipe keeps the original ID, but the smaller segment is +2 in the sequence). Any thoughts @HusseinNasser2 

0 Kudos
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

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.

 

 

 

 

0 Kudos