Good Morning,
We publish our AGOL hosted feature layers with a UTC date/time knowing then the CreationDate and EditDates will be in UTC. In addition, we have been adding a local DateTime field that gets calculated based on the CreationDate field usually in a post-survey script process.
Now with arcade expressions, I wanted to use this functionality to auto-populate these fields, but I'm seeing discrepancies for what displays on the iPads then what writes to the AGOL feature layer tables. Also if the calculations recalculate when offline data is synced, then that is another consideration as posted here:
Below is one version I have started out with, which displays accurately in Field Maps in the layer form on the tablet, but when the data is synced from offline the date writes to the feature layer table in UTC.
//var dt_now_utc = Timestamp()
var akdt = Now()
//var akdt = ToLocal(dt_now_utc)
if (IsEmpty($feature.AKCreationDate)){
return akdt;
}else{
return akdt;
}
I have also tried to this which writes to the feature layer tables better (although if it recalculates when the offline edits sync, then this no longer works). This also isn't great because it displays in the tablet 8 hours behind the current time which doesn't look accurate even though it is writing to the tables accurately.
var dt_now_utc = Timestamp()
var akdt = DateAdd(dt_now_utc, -8, 'Hours')
if (IsEmpty($feature.AKCreationDate)){
return akdt;
}else{
return akdt;
}
What is the recommended arcade functions to get a local data time field to calculate using arcade expressions with offline data collection and for the data to be accurate when offline edits sync, do these values update then to the local time I think they do change.
Thanks in advance!,
Kathy