Value doesn't fall within Domain...

267
2
01-15-2024 11:28 AM
JamesBooth
New Contributor III

I have the following code that applies a Yes or a No to the UNIT field, determined by the UNIT_NUM field. IF the UNIT_NUM field has a value, then UNIT should be "Yes". If it is blank, then UNIT should be "No":

var unitNumber = $feature.UNIT_NUM
var hasValue

IIF(IsEmpty(unitNumber), hasValue = "No", hasValue = "Yes")

 The arcade code seems to be fine, however, when I go to add a new address point, I get an error in my Create Features pane that says "Failed to create ADDR_point. Value doesn't fall within Domain: Yes_No

My Yes_No domain is set up like this and is also applied to the UNIT field of my ADDR_point feature class:

  • Domain Name = Yes_No
  • Field Type = Text
  • Domain Type = Coded Value Domain
    • Code "Yes" - Description: "Yes"
    • Code "No" - Description: "No"
  • Split & Merge Policy = Default

When I go to add a point, I get the error, but I also notice that when I click on the right arrow seen below...

JamesBooth_0-1705346697833.png

... it opens up the attributes for the new point I'm trying to create and the UNIT field is highlighted with a "N" in the cell. Not a "No", which is what I expected. If I manually select the cell, I can choose "Yes" or "No" and the point will be produced, but I want this to be automatic. Any ideas on where I've gone wrong in any of my syntax?

0 Kudos
2 Replies
BrianBulla
Occasional Contributor III

Can't you just modify your editing template so it comes up as "No" instead of "N"?  

0 Kudos
MikeMillerGIS
Esri Frequent Contributor
You need to return hasValue. I never used an Iif that way, not sure it will work either

Try:

hasValue= IIF(IsEmpty(unitNumber),"No", "Yes")
return hasValue
0 Kudos