Select to view content in your preferred language

Calculate field in arcgis pro with arcade

341
2
Jump to solution
08-19-2025 05:28 PM
jchiangGISS-T
Emerging Contributor

Hello, 

I am having issues with calculating a field using arcade. I'm trying to use a when statement to return my calculation value based on attributes of other fields. I have symbolid and acres fields that I want to use to calculate a number of plots field. Basically, if symbol id equals 2, I want number of plots to equal one. If symbolid does not equal 2, I want the number of plots to be binned based on acres. 

This is what I wrote originally and I can't seem to figure out what's wrong.

return When(
$feature.SymbolID = 2, "1",
$feature.acres >= 40, "8",
$feature.acres >= 20, "7",
$feature.acres >= 10, "5",
$feature.acres >= 0, "3",
"<Null>"
);

The code works if I don't include the symbolid part, but I don't know why that would be if the code returns a value as soon as one condition is met. 

return When(
$feature.acres >= 40, "8",
$feature.acres >= 20, "7",
$feature.acres >= 10, "5",
$feature.acres >= 0, "3",
"<Null>"
);

Much appreciated.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
BarryNorthey
Frequent Contributor

Try using Comparison Operator equal to: ==

$feature.SymbolID == 2, "1",

View solution in original post

2 Replies
BarryNorthey
Frequent Contributor

Try using Comparison Operator equal to: ==

$feature.SymbolID == 2, "1",

jchiangGISS-T
Emerging Contributor

Thank you, this worked.

0 Kudos