Working in Portal and have a hosted layer that has an integer field which represents a given calendar year.I recently realized there are some features where the value in this field represent previous years so I want to exclude them from my map using a filter. Arcade generated fields are recognized in both the symbology and pop up dialogs but they are not visible in the layer's filter dialog.
This is the case? Are you not able to utilize an Arcade calculated field within the filter dialog? To be perfectly clear, this is the dialog I'm referring to:
Solved! Go to Solution.
Ok, yeah, that would be ideal. I think I'll be able to handle my current situation using the trick of using AGO Assistant to tweak the underlying SQL query string.
Yes, it was fairly straightforward. Open up AGO Assistant and then navigate to your webmap of interest and chose "View an items JSON" from the "I Want to..." menu. The second "block" of JSON code details with the layers in the webmap. Scroll through it until you find the layer you need to tweak. Once you find the layer, you'll want to zero in on the DefinitionExpression property. Here's what it looks like in my edited webmap:
The later half of the definitionExpression sets the criteria for a date between the current year and 12 years from now. The above expression is based on an actual date field but you could also do the same thing with a text based field as well. Originally, the data I was provided had the 4 digit year stored as text. Here's the same definition but for a text based field:
"((M8UpgradeBy = 'Transition Plan') OR (M8UpgradeBy = 'Capital Project') OR (M8UpgradeBy = 'Overlay Program')) AND (m9upgradeyr >= EXTRACT(YEAR FROM CURRENT_DATE()) ) AND (m9upgradeyr <= EXTRACT(YEAR FROM CURRENT_DATE()) + 12 )"
While the version based on the text year field worked for display purposes, I had to change the underlying data to be a date field because the date slider widget I was using in WebApp Builder wasn't honoring the query expression. Once I changed it to hit an actual date field, all was well.
Ah! Thanks for the thorough response. I have some use cases for this, but not what inspired my initial search. I was hoping I could've referenced the Arcade field in this backend workaround. I did a point-poly intersection via an Arcade expression, and I'm looking to filter out the point if its corresponding poly was also filtered out.