I'm trying to write an SQL CASE expression for use within a FeatureSet/GroupBy function. I have a Date field that I'm grabbing using FeatureSetByPortalItem and I want to create a field that just puts the ages in classes.
Ideally, the dates would be dynamic as well, based on today's date and a defined age.
I'm pretty sure the indentation below is improper, but you get the idea of what I'm trying to achieve.
{
name: 'feature_age',
expression: 'CASE
WHEN date_stat => 2020 THEN 1
ELSE date_stat => 2012 THEN 2
ELSE date_stat => 1984 THEN 3
ELSE date_stat => 1850 THEN 4
ELSE NULL
END',
statistic: 'SUM'
},
Related to a previous post that I found the solution to: https://community.esri.com/t5/arcgis-dashboards-questions/data-too-big-for-a-featureset-calculation-how-else/m-p/1404223#M9338