Show distinct values in a list widget based on filters in selector widgets

437
0
09-15-2021 10:56 PM
Labels (1)
BlairPellegrino
New Contributor

Hi all

I'm wanting to use a list widget to display a list of unique species, and to filter that list based on up to 3 different selectors - REGION_A, REGION_B and SPECIES_TYPE

Ideally, I'm looking for a 'distinct values' option within the list widget (similar to what is available in an indicator widget) - but I understand this isn't available.  Without it, the list contains duplicate species names.  Example below.

BlairPellegrino_0-1631771302094.png

Which leaves me in workaround territory!  I have attempted to use a data expression with a GroupBy function  (based on this post Introducing Data Expressions in ArcGIS Dashboards (esri.com)), which successfully removes duplicates but can't be linked to the selector widgets (i.e. because the returned featureset doesn't include the fields used by the selector widget).  If I include these fields in the featureset, it no longer provides me with distinct values!

var fs = FeatureSetByPortalItem(Portal('https://xxx.arcgis.com/'), 'xxxxxxxxxxxx', 0, ['SPECIES','COMNAME','FREQUENCY']);
// Return a featureset with multiple group by statistics.  
return GroupBy(fs, ['SPECIES','COMNAME'], { name: 'NumRecords', expression: 'FREQUENCY', statistic: 'SUM' });

Has anyone found a successful workaround that provides unique values in a list widget and can be used with selector widgets?

0 Replies