Hello -
I am working in ArcGIS Dashboards in ArcGIS online. I want to create an indicator (see example below) that will display the risk value (PR_EXHYDPAR) stored in the layer as the middle text, and the percentile rank associated with that value which is not stored in the layer as the bottom text. I am trying write arcade code within the Indicator Advanced Formatting option that will order the PR_EXHYDPAR field and create a var for rank, and then calculate percentile rank to use in the bottom text. Below is what I have so far but it says "Unable to execute Arcade script", but is not showing any errors. I am not very familiar with iterate statements so guessing there is an issue there. Thanks in advance for any suggestions.
// order the layer by existing hydraulic risk
var ordered = OrderBy("PR_EXHYDPAR DESC")
//rank projects by existing hydraulic risk
var rank = 0
// iterate over the ordered layer
for(var f in ordered) {
// increase the rank
rank++
}
//calculate percentile rank for existing hydraulic risk
var pctrank = (f.rank-1)/(Count($datapoint.OBJECTID)-1)
return {
textColor:'black',
topText: 'Existing Hydraulic Risk',
topTextMaxSize: 'medium',
middleText: $datapoint.PR_EXHYDPAR,
middleTextMaxSize: 'large',
bottomText: pctrank,
bottomTextMaxSize: 'medium',
} 