Select to view content in your preferred language

Symbology from arcade expression not shown in Field Maps

172
3
Jump to solution
12-03-2024 12:10 PM
CESPEDESLUISITD
Regular Contributor

Hello everyone. I am using some code I modified to check for inspection performed within 90 days and if its over 90 days, it would revert to needing inspection.

To display this, I use green glow for inspected and red for needing inspection. 

The code is as follow

var datedata = DateOnly($feature.InspectionDate);

var today_date = DateOnly(dateadd(Today(), -90, 'days'));
var daydiff = DateDiff(datedata, today_date, 'days');
if (daydiff < -90){
return "Not Inspected Last 90 Days";
}
if (daydiff > -90){
return "Inspected";
}
else{
  return "Not Inspected Last 90 Days";
}
 
Everything works in the webmap and on any desktop agol application, but where I need it the most is on field maps for inspectors to know which one was already inspected. 
The glow is not showing up in field maps.
Has anyone tried this? Is this a bug?
Thanks
0 Kudos
1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor

The DateOnly() function is recent to the platform and I believe is still not available in ArcGIS Field Maps. See more discussion on this here:

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

You should be OK if you update the function to use Date()

https://developers.arcgis.com/arcade/function-reference/date_functions/#date

View solution in original post

3 Replies
ChristopherCounsell
MVP Regular Contributor

The DateOnly() function is recent to the platform and I believe is still not available in ArcGIS Field Maps. See more discussion on this here:

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

You should be OK if you update the function to use Date()

https://developers.arcgis.com/arcade/function-reference/date_functions/#date

CESPEDESLUISITD
Regular Contributor

Thank you Chris. 

Yes, your answer helped. I had nulls for date and the use of DateOnly was messing up in Field Maps. I updated to check for nulls and changed to Date() and it works now. Thanks again.

if (IsEmpty($feature.InspectionDate)){
  return "Not Inspected Last 90 Days";
}
else if(IsEmpty($feature.InspectionDate) == false){
  var datedata = Date($feature.InspectionDate);
  var today_date = Date(dateadd(Today(), -90, 'days'));
  var daydiff = DateDiff(datedata, today_date, 'days');
  if (daydiff < -90){
    return "Not Inspected Last 90 Days";
  }
  else if (daydiff > -90){
    return "Inspected";
  }
}
rachelm
Regular Contributor

Great solution! I would not have thought of it

0 Kudos