<?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: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083030#M5963</link>
    <description>&lt;P&gt;I'm getting the same value for either version&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="count.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19425i669AE7A6C552CF87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="count.png" alt="count.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 13:16:44 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-07-27T13:16:44Z</dc:date>
    <item>
      <title>Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082953#M5959</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;We are creating an indicator using an arcade script in a dashboard. The problem is that when calling the count() function over the feature set then it gives the true number of records, while when applying a "for" loop {for(var i in featureSet)} to increment a counter that was initialized to 0 then the final value of the counter is greater than the real number of records. Note that the same problem is happening on the main layer and on the relate table (sublayer) too. So, how to solve this and what is the reason behind it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//here is the code of the right answer of the number of records
var database = FeatureSetByPortalItem(Portal('link'), 'id',1)
//last parameter is 1 as I need to access the first sublayer
//knowing that the same problem appears when trying to access the main layer with parameter 0
return count(database)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;//here is the wrong answer of the number of records
var database = FeatureSetByPortalItem(Portal('link'), 'id',1)
//last parameter is 1 as I need to access the first sublayer
//knowing that the same problem appears when trying to access the main layer with parameter 0
var c = 0
//c is the counter of the number of records
for(var i in database){
     c=c+1
}
return c&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Arcade Expression in Dashboard" style="width: 418px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19496i8B71C355C5A7ACFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="GIS.PNG" alt="Arcade Expression in Dashboard" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Arcade Expression in Dashboard&lt;/span&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This screenshot shows the problem of how these two codes differ.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 05:46:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082953#M5959</guid>
      <dc:creator>KarimKorbane</dc:creator>
      <dc:date>2021-07-28T05:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082972#M5960</link>
      <description>&lt;P&gt;It's pretty hard to guess at the problem when we don't have the code.&lt;/P&gt;&lt;P&gt;Can you please post the relevant section?&lt;/P&gt;&lt;P&gt;Expand the comment toolbar, select "Insert/Edit Code Sample" and choose Javascript as language.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1627372970703.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19408i7129C1B6730AD928/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1627372970703.png" alt="JohannesLindner_0-1627372970703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 08:03:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082972#M5960</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-07-27T08:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082979#M5961</link>
      <description>&lt;P&gt;I edited the post and added the codes.&lt;/P&gt;&lt;P&gt;Thank you. Have a great day!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 08:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1082979#M5961</guid>
      <dc:creator>KarimKorbane</dc:creator>
      <dc:date>2021-07-27T08:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083026#M5962</link>
      <description>&lt;P&gt;I've tested both your code snippets, and I am unable to replicate this issue. Even on &lt;EM&gt;very&lt;/EM&gt; large layers with many features, the &lt;STRONG&gt;Count&lt;/STRONG&gt; function and the for loop return identical values.&lt;/P&gt;&lt;P&gt;Can you provide a screenshot of the behavior you're seeing? And if the layer in question is public, can you link to it?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 13:07:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083026#M5962</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-07-27T13:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083030#M5963</link>
      <description>&lt;P&gt;I'm getting the same value for either version&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="count.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19425i669AE7A6C552CF87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="count.png" alt="count.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 13:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083030#M5963</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-07-27T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083400#M5964</link>
      <description>&lt;P&gt;Hello Josh.&lt;/P&gt;&lt;P&gt;First of all, I would like to thank you for your support.&lt;/P&gt;&lt;P&gt;I added the screenshot in the post, so please check it when you have some time. But regarding the layer, it is not public.&lt;/P&gt;&lt;P&gt;Thank you in advance and have a great day!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 05:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083400#M5964</guid>
      <dc:creator>KarimKorbane</dc:creator>
      <dc:date>2021-07-28T05:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083401#M5965</link>
      <description>&lt;P&gt;Thank you for your support. But as you see in the post, the recently added screenshot shows the two codes and the difference in the retrieved values.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 05:51:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083401#M5965</guid>
      <dc:creator>KarimKorbane</dc:creator>
      <dc:date>2021-07-28T05:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083459#M5966</link>
      <description>&lt;P&gt;Interesting! I can't understand why it would differ. Is the layer in question public, by any chance? It would be nice if I could test this on the same data.&lt;/P&gt;&lt;P&gt;Alternately, can you test this process on some &lt;EM&gt;other &lt;/EM&gt;layer and see if it still does the same thing?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 12:40:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1083459#M5966</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-07-28T12:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade in Dashboards: Problem in Counting the Number of Records of a Feature Set</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1347325#M6822</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/462803"&gt;@KarimKorbane&lt;/a&gt;&amp;nbsp;did you ever find a resolution to this problem? &amp;nbsp;I'm having a similar issue though in my case the for loop is terminating early and returning a much smaller count than the input dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 18:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-in-dashboards-problem-in-counting-the/m-p/1347325#M6822</guid>
      <dc:creator>ShaunLangley</dc:creator>
      <dc:date>2023-11-08T18:54:21Z</dc:date>
    </item>
  </channel>
</rss>

