Hello, I'm fairly new to Arcade and I'm trying to build a data expression inside a gauge on Dashboard. I'm able to navigate to my portal layer using the following code:
var p = Portal("Organization Portal");
var feature = FeatureSetByPortalItem(p, "Item ID", Layer ID);
Now I'm trying to apply a filter to the layer. The following is what was applied to my feature layer in ArcGIS Pro as a whole before publishing as a web map. My goal is to build a gauge for each date range in order to track the counts. How would I do that here? Thanks.
//hydrants that were flow tested within a year from today
if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') < 365)
{return "Tested within a year from today"}
//hydrants that were flow tested over a year from today
else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') >= 365 &&
DateDiff(Now(), Date($feature.TEST_DATE), 'days') < 730)
{return "Tested over a year from today"}
//hydrants that were flow tested over two years from today
else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') >= 730 &&
DateDiff(Now(), Date($feature.TEST_DATE), 'days') < 1460)
{return "Tested over two years from today"}
//hydrants that were flow tested over three years from today
else if (DateDiff(Now(), Date($feature.TEST_DATE), 'days') >= 1460)
{return "Tested over three years from today"}
//hydrants that were never tested
else
{return "No ISO information"}