Before looking at the complex example in the spoiler below, I think you should review the simpler example at Extend Route not running Attribute Rules - Esri Community first because I think both will have the same underlying cause.
I am using ArcGIS Pro 3.0.2, ArcGIS Enterprise 11 (SQL Server) and ArcGIS Roads and Highways.
In the picture below I have a route named CC-TEST_0095KM which is labelled using its line name (CC-TEST). I have digitized a centerline which I am going to use to realign CC-TEST_0095KM to be a straight line.
To do that I use Realign Route:
and I get this result which looks like it has the correct measures on both the abandoned and realigned routes:
My LRS data has about 10 Attribute Rules set up with an Insert trigger to calculate among other things a Length field. I do not use an Update trigger as well because when I have tried that I get various errors from editing which has led me to believe that Location Referencing does not like them. When I looked at the rows for the above routes in the Attribute Table I noticed that Length was the same for both the abandoned and realigned routes:
The SHAPE.STLength() field looks like the right values (which are in decimal degrees).
It's like the fields have been copied from the abandoned route to the realigned one, perhaps after the Attribute Rule triggers were run.
These are the Arcade expressions I use on my Attribute Rules for START_M, END_M and Length respectively:
return Geometry($feature).paths[0][0].m;
return Geometry($feature).paths[-1][-1].m;
return $feature.END_M - $feature.START_M;
Is there a way that I can get my Attribute Rules to run correctly when Realign Route is run on data like mine?
They seem to have run correctly in tests of all other Location Referencing tools so far.
A second Realign Routes test is illustrated below:
For that I get this result.
The Length of the abandoned route is 900m which is what I would expect because I realigned from 100m to 1,000m. However, the realigned route is 1,146m which is the same as the original route rather than its new Length. Once again, the measures on the map look like they are being set correctly and it is the extra fields, that Attribute Rules are supposed to maintain, which appear not to be doing their job correctly.
A third Realign Routes test is illustrated below:
The Length of the abandoned route is 494m which is what I would expect. However, the realigned route is 1,094m which is the same as the original route rather than its expected new Length of 1,124m. Once again, the measures on the map look like they are being set correctly and it is the extra fields, that Attribute Rules are supposed to maintain, which appear not to be doing their job correctly.
Solved! Go to Solution.
@GraemeBrowning_Aurizon Please confirm that the AR is triggered on INSERT and UPDATE parameters for triggering_events as in Add Attribute Rule.
@GraemeBrowning_Aurizon Please confirm that the AR is triggered on INSERT and UPDATE parameters for triggering_events as in Add Attribute Rule.
After ensuring that my Attribute Rule triggers were all set to INSERT+UPDATE in a new Enterprise Geodatabase I ran similar tests to those in my original post and the results are now what I was hoping for!
@AyanPalit I initially had my Attribute Rules triggered on both INSERT and UPDATE but I kept getting errors (I'll need to set that again to obtain details) so I switched to just INSERT and when the error in this thread is seen it is only INSERT that will have been in place.
I've had had trouble modifying my Attribute Rules when my LRS is in the Enterprise Geodatabase so I have been setting them on the File Geodatabase that I migrate there using an ArcPy script.
I'll try changing them to INSERT and UPDATE first through the GUI, and then through my script to see if that resolves this error. If I encounter others by doing that I'll report them separately.