<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic QueryTask outStatistics in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/querytask-outstatistics/m-p/231393#M1450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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. &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var statisticDefinition = new esri.tasks.StatisticDefinition();
&amp;nbsp; statisticDefinition.statisticType = "max";
&amp;nbsp; statisticDefinition.onStatisticField = "IssueID";
&amp;nbsp; statisticDefinition.outStatisticFieldName = "NewIssueID";
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.outFields = ['*'];
&amp;nbsp; query.where = "1 = 1";
&amp;nbsp; query.outStatistics = [statisticDefinition];

&amp;nbsp; var queryTask = new esri.tasks.QueryTask(url);
&amp;nbsp; queryTask.execute(query,function(featureSet){&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When initially , there are zero features in the layer, the query is getting error out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 11:14:19 GMT</pubDate>
    <dc:creator>VIKRANTKRISHNA</dc:creator>
    <dc:date>2021-12-11T11:14:19Z</dc:date>
    <item>
      <title>QueryTask outStatistics</title>
      <link>https://community.esri.com/t5/developers-questions/querytask-outstatistics/m-p/231393#M1450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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. &lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var statisticDefinition = new esri.tasks.StatisticDefinition();
&amp;nbsp; statisticDefinition.statisticType = "max";
&amp;nbsp; statisticDefinition.onStatisticField = "IssueID";
&amp;nbsp; statisticDefinition.outStatisticFieldName = "NewIssueID";
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.outFields = ['*'];
&amp;nbsp; query.where = "1 = 1";
&amp;nbsp; query.outStatistics = [statisticDefinition];

&amp;nbsp; var queryTask = new esri.tasks.QueryTask(url);
&amp;nbsp; queryTask.execute(query,function(featureSet){&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When initially , there are zero features in the layer, the query is getting error out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/querytask-outstatistics/m-p/231393#M1450</guid>
      <dc:creator>VIKRANTKRISHNA</dc:creator>
      <dc:date>2021-12-11T11:14:19Z</dc:date>
    </item>
  </channel>
</rss>

