Select to view content in your preferred language

Filtering Arcade data expression with map extent and category selector

836
3
Jump to solution
05-17-2024 05:01 AM
RemyOlive
Occasional Contributor

Hi all,

I'm trying to filter my dashboard indicator data (that gets populated by an Arcade data expression) with 2 simultaneous actions:

- First filter is a basic map extent

- Second filter is a category selector that allows me to filter through different sites

My problem is that, individually, both map extent and category selector filters work as intended but, as soon as I use them both at the same time, one completely overlaps the other, as if the latter didn't exist.

I need both filters to be active at the same time, as some sites overlap each other, so only having a map extent filter wouldn't work all of the time.

I kind of hit a wall here, so any help would be grandly appreciated !

Feel free to ask for more information if I wasn't clear enough.

Cheers,

Rémy 

PS: I posted this like an hour ago, but it vanished from the forum, not sure if anyone already had this problem ?

0 Kudos
1 Solution

Accepted Solutions
RemyOlive
Occasional Contributor

Update on this issue:

I managed to make the two filters work with each other by creating a new attribute within the feature set that was returned by my data expression, and then using the category selector based on that new attribute,

Might not be the most efficient solution, but works well,

Cheers,

Rémy 

View solution in original post

0 Kudos
3 Replies
jcarlson
MVP Esteemed Contributor

Any chance you can share the data expression? The fact that the filters work fine independently, but not together, is very strange to me.

- Josh Carlson
Kendall County GIS
0 Kudos
RemyOlive
Occasional Contributor

Thank you for the answer, here is the expression, which is just used to create a feature set from multiple layers:

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

var Length_1 = FeatureSetByPortalItem(portal, 'ID', 74, ['*'], true)
var Length_2 = FeatureSetByPortalItem(portal, 'ID', 43, ['*'], true)
var Length_3 = FeatureSetByPortalItem(portal, 'ID', 13, ['*'], true)
var Length_4 = FeatureSetByPortalItem(portal, 'ID', 32, ['*'], true)

var combinedDict = {
  'fields': [
    { name: "Shape_Length", type:"esriFieldTypeDouble" },
    { name: "ArrivalTime", type:"esriFieldTypeDouble" },
    { name: "name", type:"esriFieldTypeString" },
  ],
  geometryType: "esriGeometryPolyline",
  features: [],
}; var i = 0;

for (var t in Length_1) {
  combinedDict.features[i++] = {
    attributes: {
      Shape_Length: t["Shape__Length"],
      ArrivalTime: 0,
      name:t["name"]
    },
    geometry: Geometry(t)
  };
} for (var m in Length_2) {
  combinedDict.features[i++] = {
    attributes: {
      Shape_Length: m["Shape__Length"],
      ArrivalTime: 0,
      name:m["name"]
    },
    geometry: Geometry(m)
  };
} for (var r in Length_3) {
  combinedDict.features[i++] = {
    attributes: {
      Shape_Length: r["Shape__Length"],
      ArrivalTime: 0,
      name:r["name"]
    },
    geometry: Geometry(r)
  };
} for (var y in Length_4) {
  combinedDict.features[i++] = {
    attributes: {
      Shape_Length: y["Shape__Length"],
      ArrivalTime: 0,
      name:y["name"]
    },
    geometry: Geometry(y)
  };
}
return FeatureSet(combinedDict)
 
What seems very weird to me is that, as told before, both work independently well but when both are activated at the same time, the "map extent" seems to take the upper hand. 
I tried activating filter actions on both indicators and layers but nothing changed.
 
Much appreciated,
 
Rémy 
 
0 Kudos
RemyOlive
Occasional Contributor

Update on this issue:

I managed to make the two filters work with each other by creating a new attribute within the feature set that was returned by my data expression, and then using the category selector based on that new attribute,

Might not be the most efficient solution, but works well,

Cheers,

Rémy 

0 Kudos