Select to view content in your preferred language

Calculation Rule - Null a field when a polyline is split on one of the split segments

717
5
04-17-2023 10:30 AM
rlyding
Regular Contributor

Hello,

Is there a method to have a calculation attribute rule set a field to null on one of the segments created when a polyline is split using the Split editing tool? The goal is to preserve the field value on one of the lines but set it to null on the other segment created during the split. I have noticed Pro assigns the smaller of the two lines the new global and objectid which is fine and I would actually prefer the smaller segment be the one that has the field set as null. I have tried a few different things such as comparing original geometry and globalid for example if(Geometry($originalfeature) != Geometry($feature) && $originalfeature.globalid != $feature.globalid) return null It detects the change in geometry, but doesn't seem to respect the globalid compare on the split feature. Is the behavior of Split tool considered an Insert and not an Update? I only want the rule to run when a line is split. Not run if the lines geometry changes via edit vertices or reshaped and is not split. My current thought is I have to do an Intersects with OrderBy and First, to pull the newest feature created after the split then update the field on that feature. Any help is appreciated. Thanks.

0 Kudos
5 Replies
MikeMillerGIS
Esri Frequent Contributor

There is no context of the split event inside the Attribute Rule.  Without knowing the update/insert is coming from a split, this will be hard to do.  

 

You could check if the insert has a value on the field and null it.  Such as a new feature should never have an ID, so you can null that out.

rlyding
Regular Contributor

Thanks for the response. I found an approach where I was checking intersecting segments for a duplicate asset id (or as you suggested check for an expected null value), resulting from the split and then taking the larger objectid of the 2 segments and nulling the desired values.

My goal was to have a unique asset id for each segment after a split. I hadn't realized the attribute rule provided in the Utility Network Solution to generate asset ids was coded in a way where if a line was split the result keeps the same asset id for the new segment. In the end I altered the existing asset id rule in the solution to generate a new id for the new segment resulting for the split.

0 Kudos
HanliePetoors
Frequent Contributor

@rlyding would you mind sharing your attribute rule code to generate the new asset id? I have exactly the same use case.

Thanks

Hanlie

0 Kudos
rlyding
Regular Contributor

@HanliePetoors Here is the attached code in text file. Rule only fires on Insert. As I noted above. I used the existing code for the asset id attribute rule provided in the ESRI Utility Network solution. The code I altered to the asset id on split is towards the bottom. When you use the split tool in Pro this will fire a Insert rule on the new line created. So what I did was use Intersects on the new feature and the feature class the feature is part of. I then filter those returned intersected lines to lines with same asset id after the split. Which in the case of using the split tool 2 features with the same asset id are returned if an asset id was existing on the original line split. From here I pass the feature to the function at the top part of the code that creates the asset id from a database sequence depending on subtype of line. In all other cases outside of a split a new id is still created on Insert of new line feature or the original id is returned.

HanliePetoors
Frequent Contributor

Thanks very much!

0 Kudos