Select to view content in your preferred language

Unique/Distinct values in a List widget

610
5
03-31-2025 09:12 AM
Status: Open
AroldoRocha
Occasional Contributor

It would be good to add the option to return a single occurrence of a given attribute to the Experience Builder list widget, avoiding having to choose to use a support table, or even use the query and filter widgets, which have the same feature.

Tags (3)
5 Comments
JeffreyThompson2

https://developers.arcgis.com/experience-builder/guide/text-widget/#dynamic-content-panel

Have you looked at the Dynamic Content options in the Text Widget?

AaronKoelker

Agree this would be really useful. For example, if had a point feature of landmarks with type and county columns, and you want to be able to use filters on the type and get a simple list of the distinct counties where that type of landmark can be found. 

Currently the only widget that seems to be able to group by unique/distinct values is the Chart widget, but that format doesn't work for everything.

@JeffreyThompson2 There doesn't appear to be a way to get distinct values out of a text field using that method. 

BlakeMorrison

This is still needed.

 

@JeffreyThompson2 - Did you have anything specific in mind?

JeffreyThompson2

@BlakeMorrison It would be possible to retrieve a single attribute value in a Text Widget using a combination of Data Views and Dynamic Text. Probably not in a useful way or what the OP was actually asking about. 

BlakeMorrison

 

 

 

I managed to almost achieve what I wanted. Perhaps this method can help someone else in the future:

  1. "Add data" to your app. Select "Arcade".
  2. Copy and adjust the below code to suit. Apply. OK. Add.
  3. Point your list widget at the 'category' field in this new data source

 

 

var portal = Portal('https://www.arcgis.com');

var fields = [
    'OBJECTID',
    'category',
];

var fs = FeatureSetByPortalItem(
    portal,
    '1234567890123456789012345',
    0, // or whatever index the layer is
    fields,
    False
);

var filterfs = Filter(fs, "category IS NOT NULL");

return GroupBy(
    filterfs,
    [
    'category',
],
    [
    {
        name: 'Category',
        expression: '1',
        statistic: 'Count',
    }
    ]
);

 

Limitations I found: Not able to filter by map extent (as there's no geometry)