Finding DISTINCT features using Arcade in List widget in Operations Dashboard

03-14-2022 01:03 PM
Occasional Contributor

I am trying to create a list with only distinct features from my table in Operations Dashboard. I am using the following Arcade script:

var provider = Distinct($datapoint["provider_name"])
return {
attributes: {
provider: provider

In the line item template in the list, I call it using {expression/provider}. I do not get any errors and it results in a provider name being listed, but I do not get unique names. Rather, it lists them all. Any ideas how to correct this?



0 Kudos
3 Replies
MVP Esteemed Contributor

The distinct function returns either an array or a FeatureSet, depending on the input.

The expression you have written here is in the dashboard formatting profile of Arcade, which cannot do what you're trying to accomplish. You're telling it to return the distinct values of the provider name of a single datapoint. The function treats this as an array with a single item in it:


Consider using a Data Expression, similar to this example.

Yours might look like this:

var portal = Portal('');

var fs = FeatureSetByPortalItem(
    'your itemid',

return Distinct(fs, 'provider_name') 
- Josh Carlson
Kendall County GIS
New Contributor

@jcarlson where do we insert this code, still in the advanced formatting? I am trying to do the same thing now. it also seems like the FeatureSetByPortalItem is not active on my end. Please could you any update on this?

0 Kudos
MVP Esteemed Contributor

Nah, follow the link in the original post. Data Expressions are separate data sources; you can create one when you define the data source for a widget.

- Josh Carlson
Kendall County GIS
0 Kudos