In a dashboard list, I'm using the following data expression to return distinct project names:
var projects = FeatureSetByPortalItem(Portal("https://www.arcgis.com"), "ITEM_ID", 1, ['project_name','status','FIELD1','FIELD2'], false)
//filter records to show in output
var status = 'Active'
var just_active = Filter(projects, "status = '"+status+"'")
//return FeatureSet of distinct project names
var proj_distinct = Distinct(just_active, ['project_name'])
return proj_distinct
Right now, project_name is the only field that's available in the List widget:
I want to modify this expression such that it returns more field values, FIELD1 and FIELD2, as these need to be filtered on. For a given project name, each of these other field values will match, meaning there would be only one value returned per field per project. How might I return more fields in the resulting FeatureSet?
Solved! Go to Solution.
Distinct can take a list of fields. Try
var proj_distinct = Distinct(just_active, ['project_name', 'field2', 'etc'])