Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ArcGIS JSAPI: Query Return Distinct - Precallback Request (V < 3.11)
require(["esri/request"], function (esriRequest) {
esriRequest.setRequestPreCallback(function(ioArgs){
// test if we're sending the request to a mapservice query
if(/query\/?$/.test(ioArgs.url)){
// if not requesting ObjectIds, count, or querying with a list of ObjectIDs, return distinct values.
if (ioArgs.content && !ioArgs.content.returnIdsOnly && !ioArgs.content.returnCountOnly && !ioArgs.content.objectIds) {
ioArgs.content.returnDistinctValues = true;
}
}
return ioArgs;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.