I was wondering if it is possible to utilize ArcGIS Velocity to detect an attribute change/edit, to trigger another action, like sending a text message or email? Has anybody done this?
@ArmstKP yes it is possible to detect a attribute change in real time. One way to do this is to use Track functions - TrackFieldWindow
https://developers.arcgis.com/arcade/function-reference/track_functions/#trackfieldwindow
Track Functions can be use in the Calculate Field and Map Field tool arcade expressions:
Here is a sample workflow using a simple AVL feed tracking snow plows with a driver name attribute that could change as time passes.
Using DriverName and the TrackFieldWindow to send a notification when the change is detected.
TrackFieldWindow ( fieldName , startIndex , endIndex )
fieldName = driverName accessed as 'driverName'
startIndex = Past Feature (-1) accessed using TrackFieldWindow(-1,0)[0]
endIndex = Current Feature (0) accessed using $feature.driverName
// Get the prior observation value for the field using TrackFieldWindowvar priorValueArray = TrackFieldWindow('driverName', -1, 0)[0];// Get the current feature observation value for the currentValue fieldvar currentValue = $feature.driverName;// Handle the case where the first value does not have a prior feature// If there is a prior value, determine if the value changedif(count(priorValueArray) < 1){return false;} else {return IIf(priorValueArray[0] != currentValue, true, false);}
Then if the past feature and current feature are the same it returns - False
If past feature and current feature are different is returns - True indicating a attribute change.
Once you have that set you can leverage the filter tool to detect that change the send out a notification.
This is just one example but this workflow can be modified to reflect other use cases
@JeffEismanGIS This is great! Thank you for such detailed step by step instructions as well! Much appreciated.
@ArmstKP Your welcome
Good Luck
@JeffEismanGIS
I copied the expression that you wrote and added my field name in. I get this error, though. Any idea?
@JeffEismanGIS Can you tell me why I might be getting the above error of "Out of Bounds"?
I have seen that error before. Is your feed running? If not start in and try it again. If it is running can you send me a sample of your data to look at. I think you have the option to message me directly.
@ArmstKP In looking a bit more into your problem there is one frontend limitation in array access of prior features, but we have a simple workaround that I could assist with on a call and screenshare. This will be fixed in our late Feb release.
@ArmstKP I wonder if it is because index -1 does not exist for the very first observation for a track, when the feed is started; and might not exist when the Velocity UI is evaluating the expression. Perhaps you could try adding "if (TrackIndex() > 0)" to the Arcade expression and only invoke TrackFieldIndex when that is true? (Just a hunch; honestly I have not tried using any of the Track functions in a Real Time Analytic and didn't even realize they would work there. Thanks @JeffEismanGIS for pointing that out!)
@JeffEismanGIS Do you know if the updates have gone through for this as of yet?
I have followed your example in the last few days and the expression/calculate field for "DidDriverNameChange_String" boolean type. I have changed the field names in the expression to represent my test source layer and it tests successfully, but it will error out at this expression/calculate field tool when running the BDA...
@ArmstKP Thanks for the follow up, what is the error you are getting when you run the Big data analytic.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.