Select to view content in your preferred language

Auto apply Shape.STLength measurements to new Shape_Len field

04-18-2024 05:57 AM
New Contributor II

I've noticed the Shape.STLength field does not get brought over into the enterprise portal after publishing. I have created a new field named Shape_Len and performed a field calculation where Shape_Len = Shape.STLength and it populates the new field successfully and appears in the portal when publishing. The issue I'm trying to figure out is that when I create a new line segment my new field doesn't auto populate similarly to the Shape.STLength field, it remains <NULL>. Is there a way to auto populate my new field whenever a new line segment is created or modified with the same value in Shape.STLength?


0 Kudos
3 Replies
Esri Regular Contributor


Introduction to attribute rules—ArcGIS Pro | Documentation

| Marcelo Marques | Principal Product Engineer | Esri |
| Cloud & Database Administrator | OCP - Oracle Certified Professional |
I work with Enterprise Geodatabases since 1997.
“ I do not fear computers. I fear the lack of them." Isaac Isimov
MVP Notable Contributor

I was having the same issues trying to do a dashboard in AGOL.  The Shape.STLength field isn't actually in the enterprise table, but is somehow connected 'on the fly'.

There is probably a better way, but to overcome this, I created a view in SQL Server, then registered that view with the database.


CREATE VIEW [dbo].[_WatermainsView]
SELECT         Material, Owner, Shape.STLength() AS Length, Shape.STLength() / 5280 AS Miles, Shape, OBJECTID


I then load that view instead of the featureclass for my services. 

This example will not only have a column named "Length" that is in map units (equal to what the Shape.STLenght() is) as well as as a column named "Miles" that is miles so I don't need to do the convertion in the dashboard or popups.


Esri Esteemed Contributor

The third option is an ON INSERT OR UPDATE trigger to preserve the contents of the actual column.

- V

0 Kudos