My asset layers, like utilities or leases, etc. have the same fields in them over and over to denote buildings related to the asset. The fields represent the building names and I am storing a boolean value in the fields (y/n). If an asset is associated with a building I place a 'y'. This is probably not ideal, but it is how it is being done. I want to show a list of buildings in the pop up so I put together this functional arcade script. Sharing it here for others that might find it helpful.
//Create list of fields that store Y/N for if a building is associated
var building_flds = ['Str_100', 'Str_101', 'Str_102']; //If new building fields are added, then add them to this list
var buildings = [];
//If a building has been marked as Yes, then add the alias to a concatenated list for display in the popup
for (var i in building_flds){
if ($feature[building_flds[i]] == 'Y') {
var aArray = Schema($layer)["fields"];
for(var j in aArray) {
var dict = aArray[j];
if (dict['name'] == building_flds[i]){
push(buildings,dict['alias']);
};
};
}
}
iif (Count(buildings)==0,push(buildings,'<em>None</em>'),buildings)
var Expression2 = concatenate(buildings, ", ")