Im trying to calculate a field called "bark t/ha" using the following expression:

if ($feature.Barkfuelhaz =="Low"){
else if($feature.Barkfuelhaz =="Moderate"){
else if($feature.Barkfuelhaz == "High"){
else if($feature.Barkfuelhaz == "Very High"){
else if($feature.Barkfuelhaz == "Extreme"){

the expression validates however when I run it, all values in the Bark/ta field change to "0"

I've even tried running a simpler one "if ($feature.Barkfuelhaz == "Moderate"){ Return "2"}" but all values still stay as 0

  • 1
    What is the data type of the field you are calculating? Maybe return "0" should be return 0? – BERA Aug 23 '19 at 7:30
  • What version of ArcGIS Pro are you using? – PolyGeo Dec 13 '19 at 4:20

To test this I used Create Fishnet to create a 3x3 grid to which I added a Text field called Barkfuelhaz and populated it as below:

enter image description here

I then added a Short Integer field that I named IntField and tried to calculate it using your expression:

enter image description here

and it worked:

enter image description here

I was a little surprised that returning strings to an integer field did not cause problems.

Consequently, I am unable to reproduce your problem. My testing was performed using a beta version of ArcGIS Pro but I would expect that ArcGIS Pro 2.4.2 would behave the same with respect to this test.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.