Select to view content in your preferred language

Auto-populate a permanent field based on Arcade Expression

8872
15
04-19-2019 02:16 PM
Status: Open
KaraUtter
Frequent Contributor

Hello,

It would be very helpful in ArcGIS Online if a layer could have a permanent field that is set up with an arcade expression that the field uses to auto-populate its value based on information from another field as new records are created from map applications. 

For example, we track our time and each record has a CATEGORY (meeting, project, internal support, etc.) that we define for our new record. These categories are then defined as 1 of 4 bins for strategic DELIVERY classification (Alignment, Projects, Support, Value). I created a blank field that only I see on the back-end named DELIVERY, which I calculate each day using an arcade expression that reads the CATEGORY field and then based on that value will fill in the DELIVERY cell as either Alignment, Projects, Support or Value. This DELIVERY field is used to provide a bar graph in a separate WebApp Builder dashboard template application that was created for our IT coordinator.

Though I can define an attribute expression with an Arcade Expression that WILL auto-generate the attribute expression field in the map, this can only be seen and used in the map pop-ups and are not visible within any of the graphic widgets for the story maps. If we could define an arcade expression for a field and allow for auto-generation of a permanent field value, that would be very helpful in streamlining dashboard processing.

Thanks,

Kara

arcade expression‌ auto populate‌

15 Comments
BamJam
by

@AlixVezina Thank you for the quick response!  That is good, but it seems to apply to all the feature types for that layer when the user is attempting to add a new feature.  I have a feature template that defines several feature types that the user can select to add to the map.  The templates allow me to set default values for fields based on which feature type they choose, which is great. However, I would also like the hint to change based on the feature type that they select.  

BamJam_1-1654898251477.png

I was hoping I could use Arcade to dynamically change the hint based on the value of a field in the layer.  Is this something that is possible?

 

Thanks,
Brandon

AlixVezina

@BamJam This is not currently possible and has similar requirements as the original idea in this post. This would be good enhancement to be implemented in the new forms once they fully leverage arcade and potentially attribute rules. Auto-populate a permanent field based on Arcade Ex... - Esri Community

Also please note that this will not be available in the Smart Editor.

AllisonGiffin

Another reason I am really hoping that sometime soon we can use smart forms with calculated attributes in WAB or allow Arcade expressions as preset attribute actions in the smart editor widget, is because it is so much easier (for me) to edit feature geometry in WAB than in Field Maps, both because using a mouse on a desk is easier than a stylus or your finger on a mobile device in the field, but also because location accuracy in Field Maps has been pretty inaccurate in my experience (I am getting 3-6 meter accuracy at best) unless I were to obtain a GNSS device to use with the Field Maps application.

However, while editing feature geometry is easier in WAB than in Field Maps, you cannot configure a field to automatically calculate geometry every time a new feature is added or an existing feature's geometry is edited in WAB. So it seems like the work flow has to be editing the feature geometry in WAB, saving, then opening Field Maps (that uses the same web map and feature layer just edited in WAB) just to trigger the automatic recalculation of the feature's geometry (by moving a vertex slightly or something) after editing the geometry in WAB. 

AlixVezina

@AllisonGiffin , regarding the statement below:

you cannot configure a field to automatically calculate geometry every time a new feature is added or an existing feature's geometry is edited in WAB

What geometry attributes are you attempting to calculate? The Smart Editor widget provides some automatic calculations that can also be triggered on feature update.

If you are looking for coordinates, setup a Coordinate attribute action. You can set it to use the feature's location or "My Location" (so the user's current device location) to populate these coordinates.

AlixVezina_0-1658246024864.png

AlixVezina_1-1658246052013.png

 

Then in the Action Settings, set the attribute actions to also update when the geometry of the feature is updated.

AlixVezina_2-1658246151046.png

There's a video where some of this is demonstrated here (starting around 4min35): https://youtu.be/2LdUvD9B_R4?t=276

Thought I'd mention this just in case it may fit your needs!

 

AllisonGiffin

Thank you Alix! Sorry I took a long time to respond to this. The features I am editing are polygons, and the geometry attribute I would like to automatically calculate is an SQL expression to calculate the square footage of each polygon feature. In Field Maps, the calculated square footage field automatically updates when I move a vertex on the polygon in Field Maps. However, moving vertices and drawing polygons is much harder in Field Maps than it is in WAB, but in WAB the feature won't automatically re-calculate since WAB does not support Smart Forms. I understand WAB is being deprecated and Experience Builder is the preferred application now though, so in the future I think everything should be fine as long as Experience Builder supports smart forms and calculated and contingent attributes.