Select to view content in your preferred language

Building a Data Expression, need current filter for the dashboard

237
0
01-24-2023 08:48 AM
PaulNRWA
New Contributor III

I'm building a dashboard that has multiple filters that can be applied to the map.  Specifically one feature layer.

I'm trying to build out a data expression that can return the average population for the filtered layer.   However, I've been unable to find a way to pull the applied filter(query) to the layer.   Thus, my returned feature set is for the full dataset and not using the filter.

IE

// Reference layer using the FeatureSetByPortalItem() function.
var fs = FeatureSetByPortalItem(Portal('https://maps.xxxx.org/portal'), '222a3cf65e6a498d8c4da9xxxx321436' , 0, ['system_id', 'system_population'], false);


// Return featureset after grouping by system_id.
return GroupBy(fs, ['system_id'],
[{ name: 'total_population', expression: 'system_population', statistic: 'AVG' }]);

Thanks in advance.

0 Replies