0

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.' My question: How do you pass a list of values to the condition in these statements? This has been surprisingly not straight forward to find online.

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

3
  • 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. 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
    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 Oct 15, 2020 at 9:10

2 Answers 2

1

For your arcade expression try something like this:

var veges= ['Carrot','Celery','Broccoli']
IIF( indexof(veges, food ) > -1 , 'Vegetable', 'Fruit') 
1
  • Anna do you have recommendations for how to make this happen in Python in the same way? For instance, if I had a list of veggies ( veg = ['Carrot', 'Celery', 'Broccoli'] ) and a list of fruits ( fruit = ['Apple', 'Banana', 'Mango'] ), the syntax for 'if value in veg, return 'Vegetable' elif value in fuit, return 'Fruit'
    – TravisB
    Oct 16, 2020 at 17:31
0

I am trying to figure out how best to say if a value is

< 0.45 then return "Well Below Average"

= 0.45 AND <0.48 return "Below Average" =0.48 AND <0.54 return "Average" =0.54 AND <0.57 return "Above Average" Else Well Above Average

I cannot seem to get it to calculate correctly. Any help would be great!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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