I am trying to count the related features when the user clicks on a feature, but my query won't run. An example of what I am trying to do in our REST Service directory is the following:
The Where Statement: SUPPORTID='691'
The URL to run the where statement: Layer: Sign (ID: 0)
I have also published app at: maps.decaturil.gov/streetSigns/
And the latest version is on github at: csergent45/streetSigns at 297fa633f0ebb529862e35b7019c04d7259fbfe8 · GitHub
In my code, I have entered the following for the code block to run the query and to display a count in the console, but it's not working:
// url the query task is to be performed on
var queryTask = new QueryTask(config.signLayerUrl);
var query = esriQuery();
// count related records
esriQuery.where = "SUPPORTID =='" + supportId + "'";
// display number of related records in console
queryTask.executeForCount(query,function(count){
console.log(count);
})
The supportId is the support ID of the feature that was clicked on.
The config.signLayerUrl is the URL that I am querying.
Why doesn't this work? I referenced the API at: https://developers.arcgis.com/javascript/jsapi/querytask-amd.html#executeforcount