Zoom to selected feature using Data Expression

4 weeks ago
New Contributor

Hello, I am using the new release of ArcGIS Dashboards (April 2021).  I have a List element which is populated from a custom Data Expression and a Map element which is driven by a single point dataset.  I've added actions to the List element so that when an item is selected in the List the map should pan/zoom/flash to the selected feature but I cannot get this to work.

If I set the data source of my List element to be the same as the point dataset in the map then the pan/zoom/flash actions work fine.

Does anyone know what is used as the link between the features drawn in the Map and features in other Dashboard Elements (e.g. the List in my case) as there is no option to specify the matching source and target fields (like you get when you configure a filter)?  I tried adding the OBJECTID from the source (point) data to the FeatureSet created in the custom Data Expression but this didn't resolve the issue.

I'm wondering if I need to add the geometry of the point features displayed in my map to the FeatureSet created in the custom Data Expression.  Would this solve the problem (are the geometries used in the pan/zoom/flash actions)?  I can't find any example of how to do this though, does anyone know?  Code snippets below:


// get FeatureSet of point features displayed in the map, including geometry:
var fsCarParkAreas = FeatureSetByPortalItem(Portal('https://www.arcgis.com'), '9e0dc7e170384732a4d28704bc18e446', 0, ['*'], true)
// make a new CombinedDictionary to hold the combined values:
var combinedDict = {
fields: [
{ name: "CarParkID", type: "esriFieldTypeInteger" },
{ name: "CarParkAreaID", type: "esriFieldTypeInteger" },
{ name: "SiteName", type: "esriFieldTypeString" },
{ name: "AreaName", type: "esriFieldTypeString" },
{ name: "PercentOccupied", type: "esriFieldTypeInteger" },
{ name: "Busyness", type: "esriFieldTypeString" },
{ name: "ManualOverride", type: "esriFieldTypeString" },
{ name: "OBJECTID", type: "esriFieldTypeInteger" },
geometryType: "",
features: [],
// code to loop through all the existing features in fsCarParkAreas
// and add in some extra values based on various conditions
// then add to the combinedDict:
// add details to CombinedDictionary
combinedDict.features[i] = {
attributes: {
CarParkID: cpid,
CarParkAreaID: carparkarea.CarParkAreaID,
SiteName: carpark.SiteName,
AreaName: carparkarea.AreaName,
PercentOccupied: percentoccupied,
ManualOverride: manualoverride,
Busyness: busyness,
// Return CombinedDictionary cast as a feature set
return FeatureSet(Text(combinedDict));



I think what I'm missing is code to add the geometry of the existing feature in fsCarParkAreas when adding features to the combinedDict (the documentation shows how to create new features but I want to use  the geometry of existing features: https://developers.arcgis.com/arcade/function-reference/data_functions/#featureset)

Any help/pointers would be greatly appreciated.

0 Kudos
0 Replies