Compare Future Date with Current Date in Arcade in ArcGIS Online

3189
19
01-08-2020 12:01 PM
joerodmey
MVP Alum

Hi,

I have a ArcGIS Online web map which has a feature layer (points) I created via Survey123. I have the feature layer symbolized based on the status (Not Complete, Complete, Follow-up/Reminder). The follow-up reminder status is the one I'm having issues with. This reminder status is set by the user via Surv123 and also has a date field associated with it. This date field contains the date that the user wants to be reminded on.

My goal is to have that particular point to display on the web map ONLY when the reminder date is hit. Today is Jan 8 and say the reminder date was set for Jan 10. Well I only want this point to show starting on Jan 10 and after that.

I was going to create the current date and time from Arcade with: Text(Now(),'MM/DD/Y hh:mm:ss')

and compare it to the reminder date via the layer filter in the web map. But this won't work as this Arcade field of current date/time doesn't show in the list of fields in the filter option in my web map.

Any solutions or better directions to take? Xander Bakker

Thanks,

Adam

19 Replies
XanderBakker
Esri Esteemed Contributor

Hi joe rodmey , 

A couple of comments on your question:

  • If you want to compare dates, don't convert that to text. Use the DateDiff to compare them
  • I don't think filtering data based on an arcade expression is possible at this moment. Perhaps define a symbol that stands out when the date is met (or has passed). 
0 Kudos
joerodmey
MVP Alum

I'm comparing in filtering not in arcade. I cant have the points visible on the map as the field crews using the map on collector use it as a work to be done tool. If they see a point they will act on it. This is why i just want to "hide" these reminder points till when they are due.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Joerodney ,

OK, cool... Have you considered Workforce to help guide your field crew to act on open assignments?

0 Kudos
joerodmey
MVP Alum

Yes I have but It wont work because of certain limitations.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Joerodney ,

Can you explain what those limitations are?

To use a filter, would require to have a physical field in your data, and that would require a scheduled task each night to update the field to filter on. This could be done with ArcGIS Pro scheduled task that will be available in version 2.5 to be released later this month.

0 Kudos
joerodmey
MVP Alum

Hi Xander Bakker‌,

There are a few of them but right now I'm not considering switching to another product. I just need a way to compare the reminder date with the current date.

Thanks

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi joe rodmey ,

Implementing Workforce would not mean switching to another product, but it would change your workflow by using this additional product. But I assume you have your reasons for not wanting to do this.

So back to the original answer; you cannot filter your data based on an Arcade expression. Just checked and this is not possible in the web map, nor in the new beta web map and neither when defining a hosted feature layer view. You will need a real field and this field should be updated (each night) for it to show the correct features. This will require updating that field each night in order to accomplish this. Field workers should refresh that data each morning to show this updates in their app.

0 Kudos
joerodmey
MVP Alum

Hi Xander Bakker‌,

What is your suggestion to perform these updates nightly?

Thanks

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi joe rodmey ,

I think it would be nice to use the new schedule geoprocessing tool, which will be available in ArcGIS Pro 2.5 (released later this month). You could implement a simple calculation comparing the current date with the scheduled date and set the scheduler to run every night.

 

0 Kudos