Hi -
I am new to arcade still and am trying to write a code that will filter records where PR_TOTSCORE is not NULL, and then rank the records on PR_TOTSCORE. The below code is working, but does not include the filtering part. I have tried different approaches but haven't been successful yet. Any suggestions?
var setfeatures = FeatureSetByName($datastore, "Stormwater Project");
//Need filter step here that filters records where PR_TOTSCORE is not NULL. I have tried using !IsEmpty but have not been successful.
// order the layer
var ordered = OrderBy(setfeatures, 'PR_TOTSCORE DESC')
var rank = 0
// iterate over the ordered layer
for(var f in ordered) {
// increase the rank
rank++
// if the feature we're looking at is the feature we clicked on, return the current rank
if(f.OBJECTID == $feature.OBJECTID) {
return rank
}
}