Some context: I have a dashboard where I want reviewers to go in and see/edit applications. The dashboard is set up and functioning, but I'd like to set up a filter/Category Selector for the dashboard based on the reviewer (each reviewer would be looking at all the applications for specific counties, i.e. Reviewer A looks at counties X, Y and Z while Reviewer B looks at counties L, M, N and O). My idea is to have a grouped value category selector based on a Data Expression that calculates who the reviewer would be for that application based on the county.
This is what I'm trying:
var p = Portal('https://www.arcgis.com');
var fs = FeatureSetByPortalItem(p,'9cfe5d169a4e4b34a79c8640b7a924ee',0,['county'], false);
var recalc = {
'fields': [{'name':'memberName', 'type':'esriFieldTypeString'}],
'geometryType': '',
'features': []
}
for(var f in fs) {
var new_f = {'attributes': {'memberName':
iif(fs["county"]=='Carbon'||'Beaver'||'Box Elder'||'Juab',"Jim XXXXX",
iif(fs["county"]=='Grand'||'Davis'||'Kane'||'San Juan'||'Uintah',"Kris XXXXX",
iif(fs["county"]=='Utah'||'Duchesne'||'Millard'||'Sanpete'||'Washington',"Anna XXXXX",
iif(fs["county"]=='Wasatch'||'Emery'||'Morgan'||'Sevier'||'Wayne',"Tracy XXXXX",
iif(fs["county"]=='Salt Lake'||'Garfield'||'Piute'||'Summit'||'Weber',"Chad XXXXX",
iif(fs["county"]=='Cache'||'Iron'||'Rich'||'Tooele'||'Daggett',"Alan XXXXX","Manual Review"))))))}}
Push(recalc.features, new_f)
}
return FeatureSet(Text(recalc))
But I always get the error:
Test execution error: Execution error - Cannot access value using a key of this type. Verify test data.
What I'm referencing is a hosted feature layer view (though no more success with the hosted feature layer), and neither are empty. There are related tables, but I am not referencing here (layers [1] and [2] are related, but [0] is the point feature layer).