AnsweredAssumed Answered

sqlWhere has no effect in summaryStatistics

Question asked by MHamiltonSmith on Dec 16, 2018

I was able to use esri/renderers/smartMapping/statistics/summaryStatistics to sum up all the "APP_COUNT" attribute values in my feature set. This seemed to work: it returns an object with the max, min, avg, sum, etc. However, when I add a sqlWhere parameter, the result is the same. I expect it to filter the features based on the where clause before calculating statistics, but this doesn't seem to be happening.

I have tried using various where clauses, including empty strings, undefined variables, and "1=2". The result is always the same as when I use no where clause.

getSummaryStats = function(){

   var params = {

      layer: _this.officeFeatureLayer,

      view: _this,

      valueExpression: "$feature.APP_COUNT",

      sqlWhere: "1=2" 

   };

   summaryStatistics(params).then(function(response){

      console.log(response); }).catch(function(response){

      console.log(response);

   });

}

Could someone provide a working example of summaryStatistics using a sqlWhere parameter?

Outcomes