Hello all,
I have been requested to make a custom pop-up that listed out all the park amenities available within a park. In the data itself, this is stored as several "Yes/No" text fields.
I found this thread from a few years ago https://community.esri.com/t5/arcgis-online-questions/arcade-output-the-field-name-alias/td-p/1064821#:~:text=I%20feel%20like%20I%20am,name'%5D%20==%20i)%7B which seems like it should work for me. But it's not looping through all the fields when I test it. I'm trying to build this within the pop-up's Arcade element. My current expression is below.
// Create a featureset, my layer is called ParkRecreationFacilities
var features = FeatureSetByName($map,"Lane County Parks", ['Campgrounds_Present','DockPier_Present','DrinkingWater','GrillsPresent','HotShowers','PicnicTables_Present','Restroom_Present'], false);
// Create a dictionary holding the schema
var aDict = Schema(features);
// Create an array of dictionary's holding field info
var aArray = aDict["fields"];
var output=''
for (var i in $feature){
if ($feature[i] == "Yes") {
for(var j in aArray) {
var dict = aArray[j];
if (dict['name'] == i){
//console(dict['alias']);
output += dict['alias'] + TextFormatting.NewLine;
}
}
}
}
return output I'd expect something like the screenshot below.

But when I specify just the fields I want to be returned, all that is returned are null values. If I set the features variable to include all fields, then it only returns the first few fields that have a "Yes" value within them.
I'm sure I'm missing something, but I'm unsure how to find it.
Thanks for all your help,
Caitlin
Lane County GIS