I am trying to populate a date field, with the date and time from the exact moment another field is updated. I am using Arcade to do this. I have been able to get the local time from the machine, and populate the date field when the other field is updated, but it keeps updating every second. I want the time field to stay at the time when the other field is first updated, and to not keep automatically updating. Below is the Arcade code:
var ResDate = ToLocal(TimeStamp())
var Status = $feature.Status
IIf(Status == 'Resolved', ResDate, null)
I am then putting this arcade expression in the layer's pop up. So, once a feature's status field is changed from 'Unresolved' to 'Resolved', I want the time to be grabbed and put in the new resolve date field. However, that time keeps getting pulled and updated. I tried using the 'break' operator for arcade with no success. So essentially, I am hoping to pull the time once, and leave it. Any help would be awesome! Arcade is still new and finding detailed documentation can be difficult. Thanks!
Scott
Hi Marques,
Thanks for the feedback. Am i correct, in that you only want the date recorded when a specific attribute is changed? For example: Only record the last precipitation date, if the users specifies Yes for the precipitation field.
Would you want to have more than one of these types of calculations per feature?
-Kelly
Hello,
I have the exact same question (I want to do the same thing as Scott) !
Do we have a final answer ?
Thank you,
Hi,
I have the same problem. In my case I'm trying to create a unique ID value utilizing Hours/Minutes/Seconds when the record is created. Both the Now() and Timestamp() functions work for this EXCEPT that the value keeps changing over the course of the user filling out the form, i.e. every time some attribute value is updated, the timestamp value will also update. This is problematic because this ID value is intended to be used for specimens being collected, i.e. it's being written on sample baggies and these two values need to match. Even more problematic is the fact that if the record is opened for editing later (possibly days later) this value will continue to update, hopelessly confusing things. This seems like kind of a niche problem but it'd be great to have a solution (besides just having users write this value into a free text field). The equivalent solution in Survey123 is to use the "Once" function to limit the re-calculation of a calculated value. Thanks!
I forgot to mention the issue for me is with Arcade used in calculating a value in the Field Maps app. Obviously in Survey123 the "once" function is not an Arcade function.