I am trying to write an arcade expression to return a list of the fields and values where the value is not null. I am filtering for the field name starting with "com". So far all I get is a blank dictionary. Just to clarify this is to populate a field which I will use to create the label.
var pattern = "com" // Substring to match field names starting with "com"
var result = {}
for (var field in $feature) {
if (Left(field, Count(pattern)) == pattern && !IsEmpty($feature[field])) {
result[field] = $feature[field]
}
}
Console(result)
return result