ArcGIS Maps SDK for JavaScript, get the number of items returned after applying a filter (client-side)

405
2
Jump to solution
03-10-2023 01:33 AM
Humberto
New Contributor

I am newbie to ArcGIS Maps  SDK for Javascript.

I have done a filter by attributes (from user selection) on client-side. It works right, but I would like to show a message if the filter doesn't return any item. Is it possible with any method with my approach or should I change it?

Here is my code : https://codepen.io/gisdevelopment/pen/OJozLzw

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

You will have to query the features on the layer view once you change the layer view's feature filter. You can do it as shown below:

// Get a query object from the filter's current configuration
const queryParams = earthquakesLayerView.filter.createQuery();
earthquakesLayerView.queryFeatures(queryParams)
.then(function(results){
   console.log("results", results.features);
});

 

 

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

You will have to query the features on the layer view once you change the layer view's feature filter. You can do it as shown below:

// Get a query object from the filter's current configuration
const queryParams = earthquakesLayerView.filter.createQuery();
earthquakesLayerView.queryFeatures(queryParams)
.then(function(results){
   console.log("results", results.features);
});

 

 

Humberto
New Contributor

Thank you very much

0 Kudos