Select to view content in your preferred language

Data Expression To Return Most Recent Date for Hydrant Inspection in Dashboard Indicator

582
10
Jump to solution
04-23-2025 08:47 AM
MelanieBass
Occasional Contributor

I have a hydrant inspection layer that I have configured a dashboard for and I am trying to get the indicator widget to reflect the correct number of hydrants still needing inspections. Currently the number is inflated because there are multiple inspections per hydrant. I have been working on trying to create a data expression to create a FeatureSet to filter most recent inspections per hydrant, but I am having no luck. Every code I have tried multiple code combinations, and it just returns an empty dataset. 

// Load the hydrant inspections layer
var inspections = FeatureSetByPortalItem(
Portal("https://maps.casselberry.org/portal"),
"f3a4a8879ce34241a5fd139ddfaf727a", // Inspection Layer Item ID
0
);

var maxDate = Text(Date(Max(fs, 'dateinspected')), 'YYYY-MM-DD');
return Filter(fs, 'dateinspected = @maxDate');

 

This code is based on this github post I had found

MelanieBass_0-1745423030227.png

 

0 Kudos
10 Replies
MelanieBass
Occasional Contributor

This worked! thanks again. 🙂

0 Kudos