HOW TO
In ArcGIS Online, multiple conditions in a single Arcade 'if else' statement are used to simplify tedious workflows that use multiple IF statements. The example below is a script with multiple IF statements.
if ($feature == 1)
{
"odd"
}
else if ($feature == 2)
{
"even"
}
else if ($feature == 3)
{
"odd"
}
else if ($feature == 4)
{
"even"
}
else if ($feature == 5)
{
"odd"
}
else if ($feature == 6)
{
"even"
}
To simplify the process, use the logical OR operator (||) to insert multiple conditions in a single IF statement.


if (($feature.Id==1) || ($feature.Id==3) || ($feature.Id==5) || ($feature.Id==7))
{
"Odd"
}
else if (($feature.Id==2) || ($feature.Id==4) || ($feature.Id==6))
{
"Even"
}
else
{
"none"
}
The following image shows the trial field is populated according to the Arcade expression.

Article ID: 000027592
Get help from ArcGIS experts
Start chatting now