Select to view content in your preferred language

Working offline filter map using Arcade expression

1404
6
07-28-2023 04:11 AM
OliverIshmael
Frequent Contributor

I have mapped features with a survey date and a resurvey frequency and i would like to filter the map to show those features which are overdue a resurvey. I believe this would require an Arcade expression like this:

IIf(DateDiff(now(), $feature.InspectionDate, 'days') < $feature["Inspection_Frequency"], "Recently Inspected", "Inspection Overdue")

Can this be implemented in Field Maps to work offline?

0 Kudos
6 Replies
SarahSaint-Ruth
Esri Contributor

Hi @OliverIshmael are you wanting to apply a layer filter or change the symbology based on whether they are overdue?

0 Kudos
OliverIshmael
Frequent Contributor

Hi @SarahSaint-Ruth either option would work. 

0 Kudos
SarahSaint-Ruth
Esri Contributor

Hi @OliverIshmael,

Date filters are planned for a future release for Field Maps. However, you would be able to change the symbology today and the script you've authored should work offline - have you tried your script, are you getting errors when trying to use it offline?

You can Arcade to change the symbology in the Map Viewer by selecting Styles and then selecting Expression:

SarahSaintRuth_0-1690803777527.png

 

 

0 Kudos
OliverIshmael
Frequent Contributor

Hi @SarahSaint-Ruth,

The problem i have with the Arcade code above is that:

$feature.InspectionDate is an attribute in a related table called Inspect the Asset, while $feature.Inspection_Frequency is an attribute in the Rec Map Assets layer

How should the Arcade code be rewritten to account for this?

0 Kudos
SarahSaint-Ruth
Esri Contributor

Ah ok - sorry to be the bearer of bad news but this won't work as imagined.  You can’t symbolize data directly from your related tables. However, you can use Arcade to process your related data that you wish to use in your symbology. There is a great blog article by Kristian Ekenes with more information on why this is the case and how to implement alternative workflows.  

ShaunGibbins
Occasional Contributor

You could add a field to the asset layer that holds the value from the date in the inspection related layer then use an attribute rule to populate the asset lvInspectedDate field every time an inspection is added.

The asset will then always hold the last inspected date value which you can then use for symbology purposes.

This does work offline, however the symbology doesn't update until a sync has succeeded as the rules are applied on the server side.

Well, this is the case for ArcGIS Enterprise using an enterprise geodatabase as a referenced datastore anyway, I have not tried offline with an AGOL hosted feature service.