Using Arcade with JavaScript AttributeEditor

198
1
03-19-2019 10:27 AM
ChrisSeabrooke1
New Contributor III

We have an application that uses the JavaScript API 3.x and a web map with  hosted feature layers. When a new feature is created, I need to auto-increment a field in that feature to the maximum value for all features in the feature layer. I was hoping to use an Arcade expression like:

 "Max($layer, 'fieldName')"

to get a value when creating a new feature. We use the Attribute Editor for creating features. We get the fields from the web map-- so our  customers can customize the fields information in the Attribute Editor.

 

From what I've read online, Arcade Expression can be used with the PopupTemplate. Is there a way to use the Attribute Editor with an Arcade Expression?

We may be able to set the value from the web map if the above isn't possible. The issue with that approach is we would have to modify the web map for multiple customers. Any suggestions are welcome.

0 Kudos
1 Reply
KellyHutchins
Esri Frequent Contributor

One approach would be to use applyEdits to update that attribute when a new feature is created. This sample in the documentation shows how to listen for draw-end to determine when a new feature is added and use applyEdits to update the attributes. 

Edit without editor widget | ArcGIS API for JavaScript 3.27 

0 Kudos