I am trying to create an immediate calculation attribute rule for a feature class in ArcGIS Pro (that I hope carries over when published as a feature service on AGOL).

I understand the basic syntax: IIF(condition, trueValue, falseValue). So if I wanted to create a rule that would take a value in my fictitious FoodName field and auto-calculate my FoodType field, I could do some thing like:

var food = $feature.FoodName
IIF(food == 'Carrot', 'Vegetable', 'Fruit')

This would, whenever the value 'Carrot' appears in the FoodName field, calculate the FoodType field to 'Vegetable.'

How do you pass a list of values to the condition in these statements?

For instance, I would like the values 'Carrot', 'Celery', 'Parsnip', and 'Broccoli' to all to auto calculate to 'Vegetable.' Perhaps it is possible to pass a list to the condition, rather than writing multiple IIF statements.

  • Pretty sure even if you get the rule you want implemented, it won't publish to AGOL. If you were working with portal you can reference your SDE dataset with the rule. Commented Oct 12, 2020 at 22:16
  • Sadly this is correct. I want the data to remain as a feature service on AGOL for permissions management. It's too bad....its on GeoNet as a fairly popular idea but so far there are no plans to implement it.
    – TravisB
    Commented Oct 14, 2020 at 18:36
  • There is new webhooks functionality that was just released on AGOL not that long ago. See esri.com/arcgis-blog/products/arcgis-online/…. You could call an FME service or integromat etc to implement a pseudo attribute rule Commented Oct 15, 2020 at 9:10

3 Answers 3


For your arcade expression try something like this:

var veges= ['Carrot','Celery','Broccoli']
IIF( indexof(veges, food ) > -1 , 'Vegetable', 'Fruit') 

Another way to do something similar but if you need more than just true/false. My case I have 170 values which could be 8 different colors. Basically create 1 list for every color and use if/else if/else. I shortened it for the post but just add as many "else if" as needed.

var field = $feature["MUTCD"] 
var mutcd = ['E5-1', 'M1-6', 'M2-1']
var mutcd2 = ['D9-2', 'M1-4']

if (indexof(mutcd, field)>-1) {
return "GREEN"
else if (indexof(mutcd2, field)>-1) {
return "BLUE"
return Null

A variation of Anna's suggestion worked for me. I needed to display categories of zoning districts from the ZONING feature layer, with several different districts belonging to each category. This was done directly in AGOL as a symbology expression.

// show zoning layer by transect using if statement for each transect 
var zoning = $feature.ZONING
var transect3 = ["RP-1", "RP-2", "R-1", "R-2", "R-3", "R-5", "NBO", "OR-1", "C-1", "CU-12"]
var transect4 = ["R-4", "OR-2", "UP-1", "MR-1", "C-2", "CP", "CU-18", "CU-26"]
var transect5 = ["OR-3", "UP-2", "CM", "CU-45", "AC", "UT"]
var transect6 = ["CC", "UV", "SCD", "ASN-A", "ASN-B", "ASN-C", "ASN-D"]

if (indexof(transect3, zoning) > -1) {
    return "Transect 3 - Neighborhood";
} else if (indexof(transect4, zoning) > -1) {
    return "Transect 4 - General Urban";
} else if (indexof(transect5, zoning) > -1) {
    return "Transect 5 - Urban Centers";
} else if (indexof(transect6, zoning) > -1) {
    return "Transect 6 - Downtown";

Based on the INDEXOF function documentation, if no values match, it returns a value of -1; thus the logical test "> -1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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