I recently reached out for help on this topic and @RhettZufelt and @gis_KIWI4 we very helpful in getting me going.
@gis_KIWI4provided me with the following arcade expression.
var attributes = Dictionary($feature)["attributes"];
var fieldInfos = [];
var attributeValues = {};
var excludeFields = ["OBJECTID", "EditDate"]; //Use this to exclude any fields, null or not null
var layer_schema = Schema($feature);
var fieldAliases = {};
for (var i = 0; i < Count(layer_schema.fields); i++) {
var field = layer_schema.fields[i];
fieldAliases[field.name] = field.alias;
}
for (var key in attributes) {
var value = attributes[key];
if (!IsEmpty(value) && value != "" && IndexOf(excludeFields, key) == -1) {
var displayName = key; // Default to field name
// Use alias if available
if (HasKey(fieldAliases, key)) {
displayName = fieldAliases[key];
}
Push(fieldInfos, { fieldName: key, label: displayName });
attributeValues[key] = value;
}
}
return {
type: 'fields',
fieldInfos: fieldInfos,
attributes: attributeValues
};
This returns the pop-ups perfectly, with display names rather than field names.
My issue is, it only works on the first point I select. If I click on a second point, it won't pull up any pop-ups.
If I then click on another layer with a pop-up and then back on the filtered pop-up layer it works again. It's like it only works once and then needs something to reset it.
Any help troubleshooting this would be much appreciated!