Select to view content in your preferred language

Using Field Calculator with iif statement, I get "Cannot assign to const value". Why, please?

2413
5
Jump to solution
07-28-2020 09:00 AM
NancyDorsey
Emerging Contributor

Arcade statement:

IIf($feature.HOLE = "HORIZONTAL",1,2)

Error: Arcade cannot assign to constant value.  Why?  I am trying to set up weighting criteria.  I tried setting the field to both long and short numbers, but still get errors.  All help appreciated.  thank you.

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Try:

IIf($feature.HOLE == "HORIZONTAL",1,2)

View solution in original post

5 Replies
JoshuaBixby
MVP Esteemed Contributor

Try:

IIf($feature.HOLE == "HORIZONTAL",1,2)
NancyDorsey
Emerging Contributor

That worked, thanks!  Too bad ESRI has it wrong or incomplete in their documentation!  Thank you again!  CORRECTION: ESRI does have it correct, I was not using the Arcade syntax but thinking of the Desktop simple and obvious language no longer used.  Sigh.  New tricks are hard.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Please close out this question if everything is working for you.

0 Kudos
NancyDorsey
Emerging Contributor

I don't know how...though it looks like I have.

0 Kudos
KenBuja
MVP Esteemed Contributor

Where is that incorrect in the documentation?

0 Kudos