Select to view content in your preferred language

Calculated expression in Field Maps failing in App but works in AGOL

460
2
Jump to solution
10-30-2024 12:20 PM
Erin3
by
New Contributor

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"

 

1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor

DateOnly() isn't available in Field Maps yet. It's version of Arcade is behind ArcGIS Online.

See this post for longer reasoning.

https://community.esri.com/t5/arcgis-field-maps-questions/arcgis-field-maps-arcade-quot-dateonly-quo...

You may be able to achieve a similar results with Text() and parsing the values as mm/dd/yy

View solution in original post

0 Kudos
2 Replies
ChristopherCounsell
MVP Regular Contributor

DateOnly() isn't available in Field Maps yet. It's version of Arcade is behind ArcGIS Online.

See this post for longer reasoning.

https://community.esri.com/t5/arcgis-field-maps-questions/arcgis-field-maps-arcade-quot-dateonly-quo...

You may be able to achieve a similar results with Text() and parsing the values as mm/dd/yy

0 Kudos
Erin3
by
New Contributor

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"