Hello -
I am working in ArcGIS Dashboards, and have a field (PR_RANK) that ranks records based upon a score (no 2 records have the same rank). I want to create a selector so users can select a set of records based upon a range of ranks (e.g. projects with a rank of 1-50). The number selector using range does not work, as rank is null for some records causing the whole dashboard to be filtered to only records with a rank. As a result, I am trying to create an arcade data expression that creates categories (1-50, 51-100, >100) based upon the rank (integer) that I can then use in a category selector. I am still new to Arcade, and I am getting an error "Test execution error: Execution error - Cannot access value using a key of this type. Verify test data." for the below code. Can anyone tell me where I am going, or I am open to suggestions of other ways to make this work.
var fs = FeatureSetByPortalItem(
Portal('https://www.arcgis.com'),
'XXXXXXXXXXXXXXXXXXX',
0,
['PROJECTID', 'PR_RANK'],
false
);
return When(
fs.PR_RANK>=1 && fs.PR_RANK<=50, "1-50",
fs.PR_RANK>50 && fs.PR_RANK<=100, "51-100",
fs.PR_RANK>100, ">100",
"n/a"
);
Thanks!
Hi LeilaJackson1, as far as i know, if we want to use new dataset created from data expression as data source of dashboard's widget, it has to be return as a "FeatureSet" type in the return line. probably you can refer to this post on how to create new featureset https://developers.arcgis.com/arcade/guide/featuresets/