<?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 expression for change since last edit? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710573#M35189</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use Arcade to calculate the difference, but&amp;nbsp;this would probably requiere a field calculation to use this in an indicator (if that where you want to show it). When I browse through the help for indicators (&lt;A class="link-titled" href="https://doc.arcgis.com/en/dashboards/get-started/indicator.htm" title="https://doc.arcgis.com/en/dashboards/get-started/indicator.htm"&gt;Indicator—ArcGIS Dashboards | Documentation&lt;/A&gt;&amp;nbsp;), it states this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Reference values on indicators are optional and, when specified, can be thought of as a predefined goal or threshold. There are three types of reference values: &lt;STRONG&gt;the indicator's previous value&lt;/STRONG&gt;, a fixed value set at design time, or a statistic calculated at run time.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this works for your situation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 May 2020 19:58:48 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2020-05-26T19:58:48Z</dc:date>
    <item>
      <title>Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710572#M35188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a COVID-19 dashboard that needs to show the change in the number of cases&amp;nbsp;since the last report. I have a table with a date field but the reporting isn't daily, so I can't just filter by things like "Today" or "Yesterday" etc. I need to find the max date and second to max date from the report records and report the change and/or rate of change.&lt;/P&gt;&lt;P&gt;The data looks something like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" style="width: 294px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="left" bgcolor="#FFFF00" height="17" style="width: 52px;"&gt;&lt;STRONG&gt;County&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="left" bgcolor="#FFFF00" style="width: 119px;"&gt;&lt;STRONG&gt;NewCasesToday&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="left" bgcolor="#FFFF00" style="width: 101px;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="17" style="width: 52px;"&gt;Eaton&lt;/TD&gt;&lt;TD align="right" style="width: 119px;"&gt;12&lt;/TD&gt;&lt;TD align="right" style="width: 101px;"&gt;05/26/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="17" style="width: 52px;"&gt;Eaton&lt;/TD&gt;&lt;TD align="right" style="width: 119px;"&gt;10&lt;/TD&gt;&lt;TD align="right" style="width: 101px;"&gt;05/27/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="17" style="width: 52px;"&gt;Eaton&lt;/TD&gt;&lt;TD align="right" style="width: 119px;"&gt;14&lt;/TD&gt;&lt;TD align="right" style="width: 101px;"&gt;05/29/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="17" style="width: 52px;"&gt;Eaton&lt;/TD&gt;&lt;TD align="right" style="width: 119px;"&gt;12&lt;/TD&gt;&lt;TD align="right" style="width: 101px;"&gt;05/30/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="17" style="width: 52px;"&gt;Eaton&lt;/TD&gt;&lt;TD align="right" style="width: 119px;"&gt;3&lt;/TD&gt;&lt;TD align="right" style="width: 101px;"&gt;06/3/2020&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I've used Arcade for simpler calculations, but this one has me stuck. Any help would be most appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 17:59:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710572#M35188</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-26T17:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710573#M35189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use Arcade to calculate the difference, but&amp;nbsp;this would probably requiere a field calculation to use this in an indicator (if that where you want to show it). When I browse through the help for indicators (&lt;A class="link-titled" href="https://doc.arcgis.com/en/dashboards/get-started/indicator.htm" title="https://doc.arcgis.com/en/dashboards/get-started/indicator.htm"&gt;Indicator—ArcGIS Dashboards | Documentation&lt;/A&gt;&amp;nbsp;), it states this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Reference values on indicators are optional and, when specified, can be thought of as a predefined goal or threshold. There are three types of reference values: &lt;STRONG&gt;the indicator's previous value&lt;/STRONG&gt;, a fixed value set at design time, or a statistic calculated at run time.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this works for your situation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 19:58:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710573#M35189</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-26T19:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710574#M35190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Xander. I think I can tease out the most recent report using max(date) but then I need to compare it to the second most recent report. Since I can't just say "yesterday" (reports don't happen every day), I'm stuck there. I imagine it must be possible to sort the dates&amp;nbsp;somehow and choose the second most recent to use as a reference to compare to the most recent. I just can't seem to figure out how that would be&amp;nbsp;accomplished in arcade. Maybe I have to do this calc on the backend with Python? I was hoping to avoid schema changes though, if I can.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update: Now I see what you mean with the indicator. It has built in field {} calcs that refer to the previous value. That in conjunction with conditionally formatting for increases and decreases will work fine. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2020 20:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710574#M35190</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-26T20:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710575#M35191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The previous value setting didn't work for me after all. The data changed but the percent change remained zero.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 13:30:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710575#M35191</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-28T13:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710576#M35192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sorry to hear that. Would&amp;nbsp;using a field calculation or defining a scheduled task in Pro be an option you would consider?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 16:56:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710576#M35192</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-28T16:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710577#M35193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out there's a bug in the previous value reference within the indicator widget and fixing it is "Not in current product plan". The data that would be easiest to use&amp;nbsp;is hosted on AGO so a scheduled task seems unlikely without getting into a lot of API stuff. Another dataset is hosted from an internal server that could maybe be query layered into the map service as a table. I was looking for more of a "set it and forget it" solution like the indicator would be if they'd fix it. Out of curiosity though,&amp;nbsp;what kind of field calc would be needed? Would it be a one time thing or would it have to be recalculated every day?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 17:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710577#M35193</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-28T17:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710578#M35194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A field calculation would not be a huge things and processing time depends largely on the volume of data that needs to be processed. The frequency of&amp;nbsp;performing the field calculation depends on what best suits your needs. There is not much API involved in this since ArcGIS Pro can directly access the data on AGOL and update it and in Pro you can schedule the field calculation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 18:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710578#M35194</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-28T18:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710579#M35195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. That could work if I can conjure an expression that'll calc the difference between the most recent and second most recent rows. Maybe create sorted lists in python and grab the first two values and subtract them? Does that sound about right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 18:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710579#M35195</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-28T18:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710580#M35196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you want to use a field calculation that does the job, for this specific case it will be much simpler to use Arcade. You can also create a standalone Python script to do the job, but this might requiere a little more lines of code.It really depends on where the data is stored. If the table and the feature layer are in the same datastore I recommend using Arcade. Is that the case? If there is a way to have access to the data I can have a look at what the expression should look like. You can share the data in a group and invite me to it "xbakker.spx". Arcade has some pretty helpful functions to access related data or filter it and using OrderBy enables you to sort the data by the data and&amp;nbsp;Top will allow you to get the top 2 items and extract the information you are looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 23:13:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710580#M35196</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-28T23:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710581#M35197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/EatonCountySS" target="_blank"&gt;EatonCountySS&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to share a little insight in what the expression may look like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// get related records&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Name of the relationship to get to related records"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// sort the related records and get top 2&lt;/SPAN&gt;
fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Top&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;OrderBy&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'DATE DES'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// get the latest and previous features&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Null&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        cnt &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f_latest &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; 
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f_prev &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// determine NewCasesToday and calculate increment&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cases_latest &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f_latest&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewCasesToday&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cases_prev &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f_prev&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;NewCasesToday&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; cases_latest &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; cases_prev&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// return the result&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:27:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710581#M35197</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T06:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710582#M35198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that. Much appreciated. I'm not all that familiar with arcade yet so I'm thinking the best approach for me is to add a previous count field to the hosted feature class. Next, I'll start doing my edits in Pro rather than on AGO directly so all edits are sent simultaneously when I save them. Before I do my daily edits to update the current counts, I'll just do a field calc on the previous count field, pushing the current values over. Then I update the current case counts. The indicator should then (in theory) work because I can provide an attribute value as a reference. Takes a few more seconds to do it that way, but it should be foolproof, I hope.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2020 16:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/710582#M35198</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2020-05-29T16:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for change since last edit?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/1333309#M54805</link>
      <description>&lt;P&gt;&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;I am trying to do something similar and calculate the the change in lake level from the most recent reading to the previous reading. I tried the code and just changed the feature and date fields to start with and get and error at the ; at the end.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Test execution error: Unexpected token '${value}'.. Verify test data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// get related records
var fs = FeatureSetByRelationshipName($feature, 'lake_level');

// sort the related records and get top 2
fs = Top(OrderBy(fs, '_date DES'), 2);

// get the latest and previous features
var result = Null;
if (Count(fs)==2) {
    var cnt = 0;
    for (var f in fs) {
        cnt += 1;
        if (cnt == 1) {
            var f_latest = f; 
        } else if (cnt == 2) {
            var f_prev = f;
        }
    }

// determine NewCasesToday and calculate increment
var cases_latest = f_latest.NewCasesToday;
var cases_prev = f_prev.NewCasesToday;
result = cases_latest - cases_prev;
}

// return the result
return result;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 13:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-for-change-since-last-edit/m-p/1333309#M54805</guid>
      <dc:creator>AJM</dc:creator>
      <dc:date>2023-09-28T13:09:32Z</dc:date>
    </item>
  </channel>
</rss>

