I'm trying to return certain fields in my popup in AGOL depending on the value in the visit type field. I'm struggling to figure out how to return the alias field name and value. Right now my expression only returns the field name. Any suggestions?
var list1 = ['COMNAME','ABUNDANCE']
var list2 = ['CLASS']
for (var i in $feature) {
if ($feature.VISITTYPE == 'Mapping') {
return list1;
}
else if($feature.VISITTYPE == 'Treatment'){
return list2
}
}
Current results in popup:
- COMNAME
- ABUNDANCE
If I change list1 to :
var list1 = [DomainName($feature,"COMNAME"), DomainName($feature,"ABUNDANCE")]
Then I get the values now but without the field alias name:
- Black mustard
- Linearly Scattered
My desired results in popup is below:
Common Name: Black mustard
Abundance: Linearly Scattered