<?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 Calculate sum in several fields with StatisticsDefinition() in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calculate-sum-in-several-fields-with/m-p/56536#M4965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/344332_buffer.JPG" style="width: 620px; height: 249px;" /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN class="" dir="ltr"&gt;I have built a widget where you can select an area and see the information that is within it, the selection is based on the radius you choose, in this case between 100 and 300 metres.&lt;BR /&gt;&lt;BR /&gt;I'd like to add a functionality so I would like to create from the first query result the sum of the four fields&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;SPAN style="color: #263238; font-size: 13px;"&gt;into the attribute table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;I found out on the API the Statitics Definition class so I used with the result from the first query but it is not working.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;I'd appreciate if someone could give some advice about the sum query.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;Thanks in advace.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;Below the code :&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;var myQuery = new Query();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.where = "1 = 1";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.outFields = ["POB_TOT", "EDAD0015", "EDAD1664","EDAD65_"];&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.returnGeometry = true;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;var myQueryTask = new QueryTask(_poblacion);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.geometry = circle;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;var sumfields = new StatisticDefinition();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sumfields.statisticType = "sum";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sumfields.onStatisticField = "POB_TOT", "EDAD0015", "EDAD1664","EDAD65_";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; myQuery.outStatistics = sumfields;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Mar 2017 17:22:52 GMT</pubDate>
    <dc:creator>SmartTarifa_</dc:creator>
    <dc:date>2017-03-27T17:22:52Z</dc:date>
    <item>
      <title>Calculate sum in several fields with StatisticsDefinition()</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calculate-sum-in-several-fields-with/m-p/56536#M4965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/344332_buffer.JPG" style="width: 620px; height: 249px;" /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN class="" dir="ltr"&gt;I have built a widget where you can select an area and see the information that is within it, the selection is based on the radius you choose, in this case between 100 and 300 metres.&lt;BR /&gt;&lt;BR /&gt;I'd like to add a functionality so I would like to create from the first query result the sum of the four fields&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;SPAN style="color: #263238; font-size: 13px;"&gt;into the attribute table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;I found out on the API the Statitics Definition class so I used with the result from the first query but it is not working.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;I'd appreciate if someone could give some advice about the sum query.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;Thanks in advace.&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;Below the code :&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="" dir="ltr"&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;var myQuery = new Query();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.where = "1 = 1";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.outFields = ["POB_TOT", "EDAD0015", "EDAD1664","EDAD65_"];&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.returnGeometry = true;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;var myQueryTask = new QueryTask(_poblacion);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.geometry = circle;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myQuery.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class=""&gt;&lt;SPAN class="" dir="ltr"&gt;var sumfields = new StatisticDefinition();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sumfields.statisticType = "sum";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; sumfields.onStatisticField = "POB_TOT", "EDAD0015", "EDAD1664","EDAD65_";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; myQuery.outStatistics = sumfields;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Mar 2017 17:22:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/calculate-sum-in-several-fields-with/m-p/56536#M4965</guid>
      <dc:creator>SmartTarifa_</dc:creator>
      <dc:date>2017-03-27T17:22:52Z</dc:date>
    </item>
  </channel>
</rss>

