Select to view content in your preferred language

How do I query a feature service to display only a subset of records?

2774
2
Jump to solution
12-04-2015 09:05 AM
deleted-user-x7XmeRtVHyGE
Deactivated User

Hello All,

I'm working to develop a javascript/html application and would like to understand how to subset features displayed from a feature service defined by an sql query. Can anyone help with resources to accomplish this?

Specifically, we would like a user input to define a where clause that then displays a map window with only the features that satisfy that where clause. Any examples of how to set up a where clause client side would be helpful!

Thanks in advance,

Mike

0 Kudos
1 Solution

Accepted Solutions
deleted-user-x7XmeRtVHyGE
Deactivated User

Robert,

Thanks for the resources. Further digging had me come across the .setDefinitionExpression() method. That seems to be the solution that works best and easiest for what I'm trying. Thanks for putting down that path.

Enjoy the day,

Mike

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   Your desired end result would be a combination of a couple of the JS API Samples.

  1. Query data without a map | ArcGIS API for JavaScript use this a starting point to learn how to use QueryTask to query a MapService based on user input.
  2. Select with Feature Layer | ArcGIS API for JavaScript would be an example of how to work with those results on a map.

There is not a sample that does exactly what you are looking for so your will have to grab necessary parts of both samples.

deleted-user-x7XmeRtVHyGE
Deactivated User

Robert,

Thanks for the resources. Further digging had me come across the .setDefinitionExpression() method. That seems to be the solution that works best and easiest for what I'm trying. Thanks for putting down that path.

Enjoy the day,

Mike

0 Kudos