<?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 Re: how to get a total rows count in table from query in javascript in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393433#M10438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Malla,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The QueryTask has more methods then execute. Executeforcount is what you want to use.&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount" title="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount"&gt;https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also you need to specify a where clause if you are not providing geometry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2018 23:13:56 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2018-10-01T23:13:56Z</dc:date>
    <item>
      <title>how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393431#M10436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;var buildinglayer=&lt;A class="link-bare" href="http://maps.miamigov.com/arcgis02/rest/services/Fire/FH_Maint/FeatureServer/1" title="http://maps.miamigov.com/arcgis02/rest/services/Fire/FH_Maint/FeatureServer/1"&gt;http://xxx.yyyyy.com/arcgis/rest/services/Building/PtrsBuilding/FeatureServer/1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to find total count of rows in table by query or ("ID" column max number)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i tried with below code, it didn't worked. can anyone suggest a method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var querytask = new Querytask(&lt;SPAN&gt;buildinglayer&lt;/SPAN&gt;);&lt;BR /&gt; var query = new Query();&lt;BR /&gt; query.returnGeometry = false;&lt;BR /&gt; query.outFields = ["ID"];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;querytask.execute(query, function (result) {&lt;BR /&gt; debugger;&lt;BR /&gt; console.log(results);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2018 21:37:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393431#M10436</guid>
      <dc:creator>Pa_Lotus</dc:creator>
      <dc:date>2018-10-01T21:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393432#M10437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should be able to use &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/query-amd.html#outstatistics"&gt;QueryTask.outStatistcs&lt;/A&gt; to get a count.&lt;/P&gt;&lt;P&gt;here is a sample&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jssamples/query_statistics_sql.html" title="https://developers.arcgis.com/javascript/3/jssamples/query_statistics_sql.html"&gt;Query Statistics with SQL Expression | ArcGIS API for JavaScript 3.26&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2018 21:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393432#M10437</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2018-10-01T21:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393433#M10438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Malla,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The QueryTask has more methods then execute. Executeforcount is what you want to use.&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount" title="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount"&gt;https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#executeforcount&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also you need to specify a where clause if you are not providing geometry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2018 23:13:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393433#M10438</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-01T23:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393434#M10439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pls note there is an important distinction between these two&amp;nbsp;options - it is how excuteCount and 'getting count from outStats' are implemented (at least for on-premises/non-hosted map and feature services).&amp;nbsp;&lt;EM&gt;Unfortunately can't say that for sure for hosted feature services though&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These implementation results in performance especially when you have a lot of data in your layer (or lots of rows matched by where-clause) - JS API &lt;STRONG&gt;executeCount&lt;/STRONG&gt; calls map/feature service query operation with returnCount=True parameter - when that happens, map/feature service asks database to &lt;STRONG&gt;return individual rows&lt;/STRONG&gt; (that matches the where-clause)&amp;nbsp;and&amp;nbsp;&lt;STRONG&gt;computes&lt;/STRONG&gt; the count by looping through&amp;nbsp;them and &lt;SPAN style="text-decoration: underline;"&gt;returns the count value back&lt;/SPAN&gt; to JS API client...&lt;/P&gt;&lt;P&gt;... versus when you execute with &lt;STRONG&gt;outStatistics&lt;/STRONG&gt;, JS API calls query operation with outStatistis=[{...}] parameter which results in a query that gets evaluated at the database level - that means map/feature service asks database to do the &lt;STRONG&gt;computation at the database level&lt;/STRONG&gt; and return the &lt;STRONG&gt;resultant number&lt;/STRONG&gt; &lt;EM&gt;instead of return individual rows&lt;/EM&gt;, that &lt;SPAN style="text-decoration: underline;"&gt;count value is&amp;nbsp;forwarded&amp;nbsp;&lt;/SPAN&gt;to JS API client.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having said that, there is a bit downside&amp;nbsp;to outStatistics approach too - it only works when the data source of the layer is one that supports this kind of query -- which is almost all data sources (&lt;SPAN style="color: #808080;"&gt;&lt;EM&gt;such as FileGDB or any enterprise database (e.g. Oracle, SQL Server, PostgreSQL etc.)&lt;/EM&gt;&lt;/SPAN&gt;) except shapefiles. Therefore you should check whether the layer, you are about to query, supports outStatistics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:18:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393434#M10439</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2018-10-02T16:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393435#M10440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tanu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;JS API executeCount calls map/feature service query operation with returnCount=True parameter - when that happens, map/feature service asks database to return individual rows (that matches the where-clause)&amp;nbsp;and does the count on the client side by looping thru those rows...&lt;/BLOCKQUOTE&gt;&lt;P&gt;Are you sure about this? The&amp;nbsp;docs for executeForCount state the return value&amp;nbsp;is just a number not a featureset.&lt;/P&gt;&lt;P&gt;&lt;A class="link-bare" href="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#event-execute-for-count-complete" title="https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#event-execute-for-count-complete"&gt;https://developers.arcgis.com/javascript/3/jsapi/querytask-amd.html#event-execute-for-count-complete&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:41:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393435#M10440</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-02T16:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to get a total rows count in table from query in javascript</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393436#M10441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;Sorry about the confusion. Yes, you are right, in the end the result that is returned by map/feature service, contains only a number not a featureset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I said '&lt;SPAN style="background-color: #f6f6f6;"&gt;does the count on the client side by looping thru those rows&lt;/SPAN&gt;',&amp;nbsp;I meant the communication between &lt;STRONG&gt;map/feature service&lt;/STRONG&gt; (being the client here) and the underlying&amp;nbsp;&lt;STRONG&gt;database&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will update my previous comment to make that explicit. Thanks for point that out to me&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-get-a-total-rows-count-in-table-from-query/m-p/393436#M10441</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2018-10-02T16:55:44Z</dc:date>
    </item>
  </channel>
</rss>

