Tracking number of edits to features

1130
12
Jump to solution
06-09-2020 11:09 AM
MichailaMusman
New Contributor III

I have a question about tracking edits to hosted feature layers in AGOL.  I have points in the field that are being edited by our crew, and the last user to edit the points is being tracked.  I'm wondering if anyone has figured out how to track how many times a point is edited, through an arcade script or adding a new field to track this.

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Michaila Musman ,

Here is a support article about setting up related table for use in Collector

How To: Set up related tables for use in Collector for ArcGIS 

And here a blog post from back in 2015 when they introduced the functionality of editing related data:

https://www.esri.com/arcgis-blog/products/field-mobility/field-mobility/related-tables-exploring-new... 

What I would probably do is create a table with fields for the date/time, the fieldworker name and probably the status of the tree so you can monitor those through time. I assume if editor tracking is enabled on the table, it will automatically record data time and the fieldworker.

You can use Arcade to show the last time the tree was watered and some statistics about how many times in the last x week or months. If you need any help with that just let me know.

View solution in original post

12 Replies
XanderBakker
Esri Esteemed Contributor

Hi mmusman_CaseyTrees ,

In you want to maintain the history of the edits, you might want to consider using a related table (assuming that the geometry does not change). This way you would be able to calculate the number of edits using a simple Arcade expression o the related records of a feature.

As you have noticed when you have editor tracking enabled on the service, you will only have information about the create date and user and the last edit, but none about the intermediate edits. In Enterprise you would be able to use an attribute rule that records a record of what change has been done by what person and at what moment in time. This is not currently available in AGOL. 

Maybe you can explain a little more about what type of data you have and why multiple fieldworkers are changing the data. This might provide some insight to your specific use case and could help to detect other alternatives.

0 Kudos
MichailaMusman
New Contributor III

Hi Xander,

Thank you for responding! I have about 9,000 points each corresponding to a tree my organization has planted.  Five teams of fieldworkers water the trees every two weeks on a rotating schedule, and almost all trees are visited more than once.  I'm trying to track how many times each tree is visited without incorporating a new field for each visit, but as of now that seems like the best option.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Michaila Musman ,

That was what I expected. In that case the geometry does not change, and you are interested in maintaining a history of when the trees were watered. We have implemented similar workflows for a client and ended up using a 1:n related table to store the history. When doing this it will affect the way you can interact with the data. It is a little harder to visualize data based on values stored in a related table. 

0 Kudos
MichailaMusman
New Contributor III

Thank you, Xander Bakker. How would I go about populating that table with edit info?  I wouldn't necessarily need to visualize it, I would probably choose to display it in a popup or a dashboard for our operations coordinator.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Michaila Musman ,

Here is a support article about setting up related table for use in Collector

How To: Set up related tables for use in Collector for ArcGIS 

And here a blog post from back in 2015 when they introduced the functionality of editing related data:

https://www.esri.com/arcgis-blog/products/field-mobility/field-mobility/related-tables-exploring-new... 

What I would probably do is create a table with fields for the date/time, the fieldworker name and probably the status of the tree so you can monitor those through time. I assume if editor tracking is enabled on the table, it will automatically record data time and the fieldworker.

You can use Arcade to show the last time the tree was watered and some statistics about how many times in the last x week or months. If you need any help with that just let me know.

MichailaMusman
New Contributor III

Excellent!  Thank you so much.

0 Kudos
Pieter_Geertvan_den_Beukel
Esri Contributor

Xander Bakker schreef:

It is a little harder to visualize data based on values stored in a related table. 

Can you elaborate on that? Do you have examples of visualisation of related attributes?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi PGvandenBeukelesri-nl-esridist , 

There are a couple of options. I recommend you to check out the blog post by Paul Barker: Visualizing related data with Join Features in ArcGIS Online . You can use Arcade to access related data a fill values in a field (using the field calculator). The FeatureSetBy functions are not available in the symbology profile though, so you need to calculate the field. This can be done by scheduling a tool in ArcGIS Pro or schedule a notebook in Enterprise. You can also use Attribute rules and use a trigger that will update a field in the featureclass when the related data is changed. This will require an Enterprise GDB or a FGDB (not available in AGOL at this moment).

MichailaMusman
New Contributor III

Hi Xander Bakker‌,

We decided not to go with a related table due to the fact that we don't want to publish our existing data again.  We've created a new field for each edit date.  I'm currently symbolizing the feature layer by edit date using a DateDiff + IfElse expression:  

var first_water_date = $feature["Last_Water"];
var first_days_dif = DateDiff(Now(), first_water_date, "days");
var result = "water status";

if (DomainName($feature,"Mntc_Condn") == "Dead") {
return "Dead"
}

else if (first_days_dif <= 14) {
 result = "Watered";
} else { (first_days_dif > 14) 
 result = "Needs Water" + $feature["plt_year"];
} 
return result;

Now that we will be updating a new field each time, I'm trying to update the expression to evaluate the most recent date field edited.  A rudimentary solution I can think of would be to assign each new date field a variable and repeat the If else format I have above, but I feel like there is a way to create a shorter nested expression of some type.  Could you provide any insight here?

0 Kudos