I have a calculated expression for a field in the form that I have set up to auto populate a "yes" or "no" response depending on the date cleaned. The arcade I have written compares the "date cleaned" (a manually filled in field) with the current date. It is set to return "Yes" if it is less than or equal to a 5 day difference and "No" if it is greater than a 5 day difference. This is working in Arcade and when I make edits in web map in AGOL but when I try making updates to the data in Field maps app on my phone it says "Failed to calculate". I don't understand why it is working in the App but not AGOL.
Here is the Arcade script:
var CleanedDate = DateOnly($feature.CleanedDate)
Var Cleaned_Status = DateDiff(DateOnly(Today()), CleanedDate, 'days')
if (Cleaned_Status <=5)
Return "Yes"
if (Cleaned_Status > 5)
Return "No"
Solved! Go to Solution.
DateOnly() isn't available in Field Maps yet. It's version of Arcade is behind ArcGIS Online.
See this post for longer reasoning.
You may be able to achieve a similar results with Text() and parsing the values as mm/dd/yy
DateOnly() isn't available in Field Maps yet. It's version of Arcade is behind ArcGIS Online.
See this post for longer reasoning.
You may be able to achieve a similar results with Text() and parsing the values as mm/dd/yy
Thank you. I was able to just remove the DateOnly() function and since my Cleaned Date field is already set as a calendar date value it worked. The new Arcade script works 🙂
var CleanedDate = $feature.CleanedDate
Var Cleaned_Status = DateDiff(Today(), CleanedDate, 'days')
if (Cleaned_Status <=5)
Return "Yes"
if (Cleaned_Status > 5)
Return "No"