How can an attribute's domain description be accessed in an Arcade expression?

5789
6
Jump to solution
03-18-2019 12:11 PM
AngelaDeegan
Occasional Contributor

In ArcPro, I'm using a custom Arcade expression in a Popup. The problem is that one of the attributes I need in the expression uses a domain and the popup displays the domain attribute code, when what I want displayed is the domain attribute description. When using such an attribute directly in a popup (i.e. without using an expression), by default it's the description that displays, so it seems surprising to me that with the Arcade expression, the default is to display the code.

How can I write the Arcade expression in a way that it displays the attribute description? 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

You can use the DomainName function to return the description

DomainName($feature, theField)

View solution in original post

6 Replies
KenBuja
MVP Esteemed Contributor

You can use the DomainName function to return the description

DomainName($feature, theField)

AngelaDeegan
Occasional Contributor

Thanks Ken. I was using the attribute in a Concatenate function and I've since realized that when not used inside a Concatenate function, the attribute appears to display the Description and not the code. So I'm think I'm good.

0 Kudos
AngelaDeegan
Occasional Contributor

Actually, it's still not working for me (mistakenly thought it was for a minute there). And I think what you're referring to is something different (the description of the domain itself). I'm trying to get the description for a code to display. My arcade popup expression is as follows. The material field uses a coded domain. So for instance, code "AC" has a description of "Asbestos Cement" and that's what I want displayed, but it's displaying "AC".

Var st = $feature.status

IIf(st=="Existing",

$feature.diameter + '" ' + $feature.material + " - Project " + $feature.project + '(' + year($feature.date_activated) + ')',

IIF(st=="Proposed",

$feature.status + " " + $feature.diameter + '" ' + $feature.material + " - Project " + $feature.project + '(' + year($feature.date_activated) + ')',

$feature.status + " " + $feature.diameter + '" ' + $feature.material + " - by Project " + $feature.abandonment_prj )

)

0 Kudos
MarkBockenhauer
Esri Regular Contributor

iif(st=="Existing", DomainName($feature, "material")," ")

This should return "Asbestos Cement"  for what you described.

AngelaDeegan
Occasional Contributor

Thanks!

0 Kudos
KelseySmuczynski
New Contributor III

What if you have a related table with coded domain values and you want to display its domain descriptions in a pop-up? I was not able to make the DomainName($feature, theField) expression/function work in this case. Does the $feature part of the expression/function need to change in some way?

0 Kudos