<?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: Pop-up in time-enabled web map to update sums/counts as date changes/arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1067501#M40575</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/287599"&gt;@kmsmikrud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;When I use a for loop I normally declare the variable outside the loop and adjust it inside the loop. In this case, we don't have a for loop and can simply declare the variable when we assign the first content to it.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jun 2021 19:23:11 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-06-11T19:23:11Z</dc:date>
    <item>
      <title>Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1057435#M40039</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a web map with AGOL hosted feature layers that are time enabled based on CreationDate. This web map is used in web app builder and has the time-slider widget configured to show survey data for each day. I am trying to figure out in the pop-up how to get the data to update to what the map is showing on the time-slider for summaries and totals.&lt;/P&gt;&lt;P&gt;Currently for the survey polygons, I would like to show feature counts and summaries. The below code works but just summaries the entire point feature layer for all survey days. I can add a date filter but I don't want the data to be tied to a specific date and have a filter for 5/3, 5/4, 5/6...&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var sm_hschool = Intersects(FeatureSetByName($map, "Herring School:"), $feature);
return Round(Sum(sm_hschool, "NUMSMALL"),0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Kathy&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 00:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1057435#M40039</guid>
      <dc:creator>kmsmikrud</dc:creator>
      <dc:date>2021-05-13T00:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1057614#M40045</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/287599"&gt;@kmsmikrud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;As far as I can see the $layer returns the entire featureset and does not take into account the current state of the layer (like filtered on a date-time range using the slider). It would be a great enhancement to have access to this "state" and being able to get a result taking into account that state.&lt;/P&gt;&lt;P&gt;Are you willing to create an idea for this?&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 14:01:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1057614#M40045</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-13T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1063938#M40360</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Darn I was hoping you would have a solution, but thanks so much for answering so quickly and pardon my delay. I will create an idea for this. I would have thought this would be a pretty typical use for use with the time-slider widget and wanting to count and sum totals for features.&lt;/P&gt;&lt;P&gt;Would you perhaps be able to help troubleshoot a work-around?&amp;nbsp; For this time series there are only 7 survey dates so I thought in the pop-up I would just filter the data for each survey data and then use that to intersect and sum.&lt;/P&gt;&lt;P&gt;I am a beginner with arcade and had the code below for an expression, but I keep getting token errors at the bottom in the result section. Do you have suggestions for improving this lengthy code and then having it print multiple results?&lt;/P&gt;&lt;P&gt;Thanks in advance and I will create an idea.&lt;/P&gt;&lt;P&gt;Kathy&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dt_query0503 = " CreationDate &amp;lt;= timestamp '2021-05-04 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-03 08:00:00'";
var dt_query0504 = " CreationDate &amp;lt;= timestamp '2021-05-05 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-04 08:00:00'";
var dt_query0505 = " CreationDate &amp;lt;= timestamp '2021-05-06 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-05 08:00:00'";
var dt_query0506 = " CreationDate &amp;lt;= timestamp '2021-05-07 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-06 08:00:00'";


var sec_dt03_schools = Filter(FeatureSetByName($map,"Herring School:"),dt_query0503)
var sec_dt04_schools = Filter(FeatureSetByName($map,"Herring School:"),dt_query0504)
var sec_dt05_schools = Filter(FeatureSetByName($map,"Herring School:"),dt_query0505)
var sec_dt06_schools = Filter(FeatureSetByName($map,"Herring School:"),dt_query0506)

    
var section_school03 = Intersects(sec_dt03_schools, $feature);
var FB_03 = Round(Sum(section_school03, "FINAL_BIO"),2)

var section_school04 = Intersects(sec_dt04_schools, $feature);
var FB_04 = Round(Sum(section_school04, "FINAL_BIO"),2)

var section_school05 = Intersects(sec_dt05_schools, $feature);
var FB_05 = Round(Sum(section_school05, "FINAL_BIO"),2)

var section_school06 = Intersects(sec_dt06_schools, $feature);
var FB_06 = Round(Sum(section_school06, "FINAL_BIO"),2)

var result = "";
{
    result = "5/3/21: " + FB_03;
    result += TextFormatting.NewLine + "5/4/21: " + FB_04;
    result += TextFormatting.NewLine + "5/5/21: " + FB_05;
    result += TextFormatting.NewLine + "5/6/21: " + FB_06;
} 
return result;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 04:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1063938#M40360</guid>
      <dc:creator>kmsmikrud</dc:creator>
      <dc:date>2021-06-02T04:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1065328#M40454</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/287599"&gt;@kmsmikrud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Sorry for the delay. Can you try the following and see if it works?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// can you validate if the query is valid?
var dt_query0503 = "CreationDate &amp;lt;= timestamp '2021-05-04 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-03 08:00:00'";
var dt_query0504 = "CreationDate &amp;lt;= timestamp '2021-05-05 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-04 08:00:00'";
var dt_query0505 = "CreationDate &amp;lt;= timestamp '2021-05-06 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-05 08:00:00'";
var dt_query0506 = "CreationDate &amp;lt;= timestamp '2021-05-07 07:59:59' AND CreationDate &amp;gt;= timestamp '2021-05-06 08:00:00'";

// access the layer and intersect it a single time with the feature
// and only retrieve the attribute you need
var fs = Intersects(FeatureSetByName($map, "Herring School:", ["FINAL_BIO"], False), $feature);
var sec_dt03_schools = Filter(fs, dt_query0503);
var sec_dt04_schools = Filter(fs, dt_query0504);
var sec_dt05_schools = Filter(fs, dt_query0505);
var sec_dt06_schools = Filter(fs, dt_query0506);

// do the Sum on the featuresets from the previous step
var FB_03 = Round(Sum(sec_dt03_schools, "FINAL_BIO"), 2);
var FB_04 = Round(Sum(sec_dt04_schools, "FINAL_BIO"), 2);
var FB_05 = Round(Sum(sec_dt05_schools, "FINAL_BIO"), 2);
var FB_06 = Round(Sum(sec_dt06_schools, "FINAL_BIO"), 2);

// create the result string
var result = "5/3/21: " + FB_03;
result += TextFormatting.NewLine + "5/4/21: " + FB_04;
result += TextFormatting.NewLine + "5/5/21: " + FB_05;
result += TextFormatting.NewLine + "5/6/21: " + FB_06;

// return the result
return result;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 22:02:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1065328#M40454</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-06-04T22:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1066422#M40532</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The above code works great!! thank-you!! It is so great to see it work and how you made the code more efficient. I was looking at other examples of code and GeoNet posts, and I see you removed the var result = ""; Why is this not needed in this code but needed in others? Thanks s much!&lt;/P&gt;&lt;P&gt;Kathy&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 15:28:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1066422#M40532</guid>
      <dc:creator>kmsmikrud</dc:creator>
      <dc:date>2021-06-09T15:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Pop-up in time-enabled web map to update sums/counts as date changes/arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1067501#M40575</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/287599"&gt;@kmsmikrud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;When I use a for loop I normally declare the variable outside the loop and adjust it inside the loop. In this case, we don't have a for loop and can simply declare the variable when we assign the first content to it.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 19:23:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/pop-up-in-time-enabled-web-map-to-update-sums/m-p/1067501#M40575</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-06-11T19:23:11Z</dc:date>
    </item>
  </channel>
</rss>

