Select to view content in your preferred language

QueryTask outStatistics

2806
0
08-07-2015 07:29 AM
VIKRANTKRISHNA
Regular Contributor

I need to run a query to get max value of field "IssueID", and then increment this value to add new feature to the layer.

var statisticDefinition = new esri.tasks.StatisticDefinition();
  statisticDefinition.statisticType = "max";
  statisticDefinition.onStatisticField = "IssueID";
  statisticDefinition.outStatisticFieldName = "NewIssueID";
    var query = new esri.tasks.Query();
  query.outFields = ['*'];
  query.where = "1 = 1";
  query.outStatistics = [statisticDefinition];

  var queryTask = new esri.tasks.QueryTask(url);
  queryTask.execute(query,function(featureSet){

When initially , there are zero features in the layer, the query is getting error out.

0 Kudos
0 Replies