In ArcGIS Online, I have a Filter widget applied to some polygons representing project areas. I have a Text widget configured to dynamically display the name of the project. When no filter is applied (ALL projects are visible) I would like the dynamic text to display something like 'Select a Filter' or just appear blank or something - right now it always shows the first project record as a default when no project is selected in the filter. I think this can be accomplished with a text widget arcade expression but I'm not sure how to put it together. I've tried the 'View for empty selection' of the data source and switching 'Default' and 'Selected features' in the text widget and dynamic content properties but nothing changes. Thanks.
The Arcade script for the Text widget looks like this:
// Documentation: https://arcg.is/18ejKn3
function getFilteredFeatureSet(ds) {
var result = ds.layer;
var queryParams = ds.queryParams;
if (!IsEmpty(queryParams.where)) {
result = Filter(result, queryParams.where);
}
if (!IsEmpty(queryParams.geometry)) {
result = Intersects(result, queryParams.geometry);
}
return result;
}
// Projects
// The filteredFeatureSet1 has already been filtered using spatial filters and attribute filters.
// var filteredFeatureSet1 = getFilteredFeatureSet($dataSources["dataSource_2-1989fddf1cf-layer-14"]);
// selectedFeatures1 is the selection view of data source.
// var selectedFeatures1 = $dataSources["dataSource_2-1989fddf1cf-layer-14"].selectedFeatures;
// NOTE: When using selectedFeatures, cases with no selected features must be handled manually.
return {
value: '',
text: {
// size: 14,
// color: 'rgb(0, 0, 255)',
// bold: true,
// italic: false,
// underline: false,
// strike: false
},
};