Select to view content in your preferred language

Pop ups AGOL using the label for domains

679
2
Jump to solution
03-04-2024 09:11 AM
Labels (2)
RosieLaura
Occasional Contributor

I am trying to set up pop ups of environmental data which uses the label in the domain rather than the code value. At the moment I have been setting up the pop ups using else if statements. 

e.g.

var Type = $feature.lifestage;
if  (Type == 'A') {Type = 'adult';}
else if (Type == 'Lva') {Type = 'larvae';}
else if (Type == 'E') {Type = 'egg';}
return Type;

However I need to do the same thing for species data using a domain of plant lists which is several thousand rows long so can't use the same code as above. I'm sure there must be a simple solution that I am hoping someone can share with me. Example subset of domain is below. 

CODEDESC
NBNSYS0200001285Abelia
NBNSYS0000139224Abies (Firs)
NHMSYS0000455513Abies alba (European Silver-fir)
NBNSYS0000042419Abies amabilis
BMFAbies bornmuelleriana (Trojan Fir)
NBNSYS0000034340Abies cephalonica (Greek Fir)
NHMSYS0021109850Abies fraseri (Fraser Fir)
NHMSYS0000455520Abies grandis (Giant Fir)
NBNSYS0000034011Abies nordmanniana (Caucasian Fir)
NBNSYS0000140832Abies procera (Noble Fir)
NBNSYS0000139234Abutilon
NHMSYS0100000348Abutilon theophrasti (Velvetleaf)
NBNSYS0000139235Acacia (Australian Blackwood)
NHMSYS0000455529Acacia melanoxylon (Australian Blackwood)
NBNSYS0000139236Acaena
NBNSYS0000003391Acaena anserinifolia (Bronze Pirri-pirri-bur)
NBNSYS0000014912Acaena anserinifolia x inermis (Pirri-Pirri-Bur)
0 Kudos
1 Solution

Accepted Solutions
MarkBockenhauer
Esri Regular Contributor

You can use Arcade and DomainName  to get the Label or Description for the domain.  

mark

View solution in original post

2 Replies
MarkBockenhauer
Esri Regular Contributor

You can use Arcade and DomainName  to get the Label or Description for the domain.  

mark

jcarlson
MVP Esteemed Contributor

Is this actually a domain on the field itself? As @MarkBockenhauer  notes, the DomainName function is exactly what you want.

If the values are maintained in some other table, there might still be a way to do it.

- Josh Carlson
Kendall County GIS