I want to be able to use Arcade expressions in layer filters. I can use Arcade expressions to help style layers in a map, but I cannot use them to filter hosted layer views independent of a map.
In particular, my need is this: I have a hosted layer of projects. The projects have start and end dates - perhaps projected dates - but just the pair of date fields.
I want to create three views from that layer:
- Projects in this calendar year
- Past projects, those that ended in a past calendar year
- Future projects, those that begin in a future calendar year
A filter "STARTING is before 1/1/2023 and ENDING is after 12/31/2021" is not acceptable as it needs to be updated every January 1st. I want filters that can calculate the current year.
Building a view with the "in the last 1 year" expression available does not work. Today is December 16, 2022. Using "in the last 1 years", returns projects that ended on December 21, 2021. I do not want those projects.
Next month, in 2023, I want the current year layer view to show the 2023 projects.
(edit 6/Feb/2023)
In a map, I can apply "$feature.STARTING < Date(Year(Date())+1,0,1) && $feature.ENDING > Date(Year(Date())-1,11,31,23,59,59)" "Year(Today()) >= Year($feature.STARTING) && Year(Today()) <= Year($feature.ENDING)" to the style to draw only this calendar year's projects.
I want to be able to build a stand-alone view in the form of "STARTING is before Date(Year(Date())+1,0,1) and ENDING is after Date(Year(Date())-1,11,31,23,59,59)" "Year(Today()) >= Year($feature.STARTING) && Year(Today()) <= Year($feature.ENDING)"