re: Updating Dashboard based on Related Table of Survey123 Records

494
2
01-21-2022 09:20 AM
by Anonymous User
Not applicable

Hi all,

I am trying to configure some dashboards to update based on records submitted to a related table from Survey123. Data includes:

  1. Hosted feature layer of points (levee inspections)
  2. Survey123 form for responding to inspections
  3. Related table of survey records

The survey form has a question to enter status of resolution (resolved: no, in progress, resolved)

What I would like to do is update a field in the hosted feature layer to reflect what is entered by the survey form for that point, so that the dashboard count widgets update, and also so that "resolved" inspections no longer display on the map. I'm not sure what the best way is to go about this - is there a way to enter an If/Then that automatically updates one field in the hosted feature layer based on records in the related table? Appreciate any documentation or suggestions!

Thanks.

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

Using Arcade is a good way to go.  While they are not "real" fields they can do must things.  Eventually Attribute expression may be more what you want but they are not here in AGOL yet (heard soon so look them up also).  You can also go old school and run a nightly script.

You will want to look in to the Arcade FeatureSet functions.  They allow you to look into the related records and grab info.

For Ops Dashboard take a look at Data Expressions.  They combine Arcade expressions into new data.

Below is some sample code and check out these links.

https://community.esri.com/t5/arcgis-online-documents/using-featuresetby-functions-in-arcade-to-dril...

https://www.arcgis.com/home/group.html?id=ba3070ceede54f1981012811c51b7f78#overview

https://www.esri.com/arcgis-blog/products/ops-dashboard/announcements/introducing-data-expressions-i...

There was also a great post on this to calculate days past and such but I cannot find it.

Sample Ops data expression lookup

var p = 'https://arcgis.com/'; 
var tbl = FeatureSetByPortalItem(Portal(p),'d14444449',9,['UnknownCode'], geometry = false);
var dups = []
var Dict = {  
 'fields': [{ 'name': 'dups', 'type': 'esriFieldTypeString' }],  
 'geometryType': '',   
 'features': []};  
var index = 0
var last = ''
for (var f in OrderBy(tbl, "UnknownCode")) {
    if (f.UnknownCode == last) {
        Dict.features[index] = {   
            'attributes': {   
                'dups': last,
            }}   
        ++index
        
    }
    last = f.UnknownCode
}
return FeatureSet(Text(Dict));

   Hope that helps

0 Kudos
by Anonymous User
Not applicable

Thanks so much Doug, we'll give this a go and report back! ^_^ 

0 Kudos