Hello! I am trying to return the alias field name rather the the actual field name for a pop-up in a hosted feature layer in Arcade. Basically I am searching my feature layer for any field that has the value "Yes" and want to return a list of fields. I am trying to use the schema function but keep getting a syntax error. Does anyone have any ideas on what I am doing wrong?
// Create a featureset, my layer is called ParkRecreationFacilities
var features = FeatureSetByName($map,"Park_and_Recreation_Facilities_public - Park and Recreation Facilities", ['*'], false);
// Create a dictionary holding the schema
var aDict = Schema(features);
// Create an array of dictionary's holding field info
var aArray = aDict["fields"];
// Access dictionary directly for field position 1
var aDict2 = aArray;
//Create output variable that will pull alias field name
var output = aDict2["alias"];
var returnstring = "Yes"
for (var i in $feature) {
if ($feature[i] == returnstring) {
output += i + TextFormatting.NewLine;
}
}
return output