Building and executing a Query task

Query tasks are designed to query featureLayer. Thus, to instantiate querytask, we need to provide the URL of featurelayer. In version 3.15 of the API, the module is named esri/tasks/QueryTask.

The QueryTask constructor

The syntax for the QueryTask constructor is as follows:

newQueryTask(url, options?)

The example for the QueryTask constructor is as follows:

require([
"esri/tasks/QueryTask", ...
], function(QueryTask, ... ) {
varqueryTask = new QueryTask("<Feature Layer URL>")
});

Constructor parameters

The URL of a feature layer that has query functionality is enabled, to verify that the query functionality on a feature layer is enabled, we have to visit the Service Catalog of the map service and check that Query ...

Get ArcGIS for JavaScript Developers by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.