<?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 function TrackFieldWindow() question -- in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688151#M7694</link>
    <description>&lt;P&gt;Well, it's much better, although I honestly do not understand the results I see --&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function trackFieldWindow() takes the Field Name, the Start Index and the End Index.&amp;nbsp; So I had that I wanted, -2, -1, and 0 index positions,&amp;nbsp; With your change of setting the End Index to 1 I am seeing a count() of three in some cases, although I see multiple counts of 1 and 2 before I see it get up to three sometimes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, trackFieldWindow(speedInMPH, -1, 1)Window;&amp;nbsp; gives me an error .&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Test execution error: Unexpected identifier.. Verify test data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2026 20:12:08 GMT</pubDate>
    <dc:creator>JeffSilberberg</dc:creator>
    <dc:date>2026-03-03T20:12:08Z</dc:date>
    <item>
      <title>Arcade function TrackFieldWindow() question --</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688115#M7692</link>
      <description>&lt;P&gt;I am struggling with what I thought would be an easy task..&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically,&amp;nbsp; I have a Velocity RTA that needs to determine if a vehicle is speeding by looking at three successive reports and if they are all over the limit, flag a speeding violation --&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the Feed uses the UnitId as the Track_id and the Event_time as the Start_time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the Calculate Field I have the following Arcade --&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Get last 3 speed observations&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;speeds&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;TrackFieldWindow&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"speedInMph"&lt;/SPAN&gt;&lt;SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Check that all 3 speeds are &amp;gt; 25 MPH&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;Count&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;speeds&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;speeds&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;] &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;25&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;speeds&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;] &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;25&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;speeds&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;] &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;25&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But when I add some additional logic and acpture the values of count(speeds)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;it's always two which is the Index not the Count. And the if I read the&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Documentation properly speeds[0] is Current, Speeds[1] is previous report and &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;speeds[2] is two previosu of the current report. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Anway, my question is my trackFieldWindow() not correct or is something else going&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;on here ?? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/track_functions/#trackfieldwindow" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/track_functions/#trackfieldwindow&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Mar 2026 18:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688115#M7692</guid>
      <dc:creator>JeffSilberberg</dc:creator>
      <dc:date>2026-03-03T18:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade function TrackFieldWindow() question --</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688126#M7693</link>
      <description>&lt;P&gt;From the way I read it, your code would only return two items. Take a look at the second example in the documentation:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Your track has a field named Speed with sequentially ordered values of [10, 20, 30, 40, 50]. The geometries of the features are [{x: 1, y: 1},{x: 2, y: 2} ,{x: null, y: null},{x: 4, y: 4}, {x: 5, y: 5}]. The expression is evaluated at each feature in the track. For this example, we examine results when evaluated at the third feature (30). Results are returned inclusive of the start feature, and exclusive of the end feature.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN&gt;var window = TrackFieldWindow('Speed', -2,2)&lt;/SPAN&gt;&lt;SPAN&gt;window;&lt;/SPAN&gt;&lt;SPAN&gt;// returns [10,20,30,40]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What happens when you use this syntax?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Get last 3 speed observations
var speeds = TrackFieldWindow("speedInMph", -2, 1);

// Check that all 3 speeds are &amp;gt; 25 MPH
return
    Count(speeds) &amp;gt;= 3 &amp;amp;&amp;amp;
    speeds[0] &amp;gt; 25 &amp;amp;&amp;amp;
    speeds[1] &amp;gt; 25 &amp;amp;&amp;amp;
    speeds[2] &amp;gt; 25;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2026 19:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688126#M7693</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2026-03-03T19:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade function TrackFieldWindow() question --</title>
      <link>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688151#M7694</link>
      <description>&lt;P&gt;Well, it's much better, although I honestly do not understand the results I see --&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function trackFieldWindow() takes the Field Name, the Start Index and the End Index.&amp;nbsp; So I had that I wanted, -2, -1, and 0 index positions,&amp;nbsp; With your change of setting the End Index to 1 I am seeing a count() of three in some cases, although I see multiple counts of 1 and 2 before I see it get up to three sometimes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, trackFieldWindow(speedInMPH, -1, 1)Window;&amp;nbsp; gives me an error .&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Test execution error: Unexpected identifier.. Verify test data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2026 20:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/arcade-function-trackfieldwindow-question/m-p/1688151#M7694</guid>
      <dc:creator>JeffSilberberg</dc:creator>
      <dc:date>2026-03-03T20:12:08Z</dc:date>
    </item>
  </channel>
</rss>

