I have a Survey Date attribute in feature layer that I have set to populate with calculated expression in the smart form. When you open the form to edit the point (not create a new point), the date field is updated to the current date since the calculated expression is now(). Is there a way to not trigger the calculated expression if the field is already populated?
When I try to only update if the survey date field is null, I receive an Invalid DateTime error in the form.
//Arcade snip for calculating new date if the survey date field is empty
if (IsEmpty($feature.SurveyDate)) {
return now()
} else {
return $feature.SurveyDate
}
result
EDIT: This layer is from a feature service published from a SDE database. The survey date field is a Date type field.
Try converting the existing date to Number:
if (IsEmpty($feature.SurveyDate)) {
return Now()
}
return Number($feature.SurveyDate)
Good idea @JohannesLindner but unfortunately I am still receiving the "Invalid DateTime" in the smart form. I made an edit to my initial post adding in that the layer is from a published feature service in SDE...not sure if that is an issue here or not.