<?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: Calculate Field using data from the next record in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80487#M2804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;derklauer, thanks, that helped a lot. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne, I actually figured out a way to kind of fudge it enough for my purposes. I used the Sort tool to reverse sort on a copy of the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;objectID field. Then I used my little script (modified with help from the doc derklauer provided). Works like a charm and can probably be all thrown together in one python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Oct 2012 17:35:52 GMT</pubDate>
    <dc:creator>BradCabe</dc:creator>
    <dc:date>2012-10-18T17:35:52Z</dc:date>
    <item>
      <title>Calculate Field using data from the next record</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80484#M2801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having trouble trying to figure out how to use the calculate field function to calculate a field based on the next record. I have a lines database that are organized based on a particular ID field (MMSI_Date, a text field). For example, 1000 lines have MMSI_Date ABC, 1100 lines have MMSI_Date DEF, etc. The problem is that the last record in each MMSI_Date group should be associated with the next group. Its a problem with the tool I used to generate this data. So this is what I have tried to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pre-Logic&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Static lastTid as variant Dim newVal as Short&amp;nbsp; If (lastTid = [MMSI_Date]) Then &amp;nbsp;&amp;nbsp; newVal = 1 Else &amp;nbsp;&amp;nbsp; newVal = 0 End If lastTid = [MMSI_Date]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;lastTid&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Needless to say, this isn't working. In fact, I am getting a general 999999 Error. Note: I have some beginner-level experience with VB in field calculations, but have never done anything at this level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help or insight are appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 13:31:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80484#M2801</guid>
      <dc:creator>BradCabe</dc:creator>
      <dc:date>2012-10-18T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field using data from the next record</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80485#M2802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am having trouble trying to figure out how to use the calculate field function to calculate a field based on the next record. I have a lines database that are organized based on a particular ID field (MMSI_Date, a text field). For example, 1000 lines have MMSI_Date ABC, 1100 lines have MMSI_Date DEF, etc. The problem is that the last record in each MMSI_Date group should be associated with the next group. Its a problem with the tool I used to generate this data. So this is what I have tried to do:&lt;BR /&gt;&lt;BR /&gt;Pre-Logic&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Static lastTid as variant
Dim newVal as Short

If (lastTid = [MMSI_Date]) Then
&amp;nbsp;&amp;nbsp; newVal = 1
Else
&amp;nbsp;&amp;nbsp; newVal = 0
End If
lastTid = [MMSI_Date]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Expression&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lastTid&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Needless to say, this isn't working. In fact, I am getting a general 999999 Error. Note: I have some beginner-level experience with VB in field calculations, but have never done anything at this level.&lt;BR /&gt;&lt;BR /&gt;Any help or insight are appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a good field calculator reference that will tell you how to do what you are asking.&amp;nbsp; Source&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://nrm.salrm.uaf.edu/~dverbyla/nrm638/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://nrm.salrm.uaf.edu/~dverbyla/nrm638/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80485#M2802</guid>
      <dc:creator>DanielErklauer</dc:creator>
      <dc:date>2021-12-10T23:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field using data from the next record</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80486#M2803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you attach a sample of your data?...and a better description of the calculation you intend to perform?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on your initial description, it doesn't sound possible because that isn't the way the field calculator works - however, it may be possible to 're-sort' your table or read the values in memory and perform the calculation via Python.&amp;nbsp; Also, are you open to a script solution instead?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 13:50:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80486#M2803</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-10-18T13:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field using data from the next record</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80487#M2804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;derklauer, thanks, that helped a lot. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne, I actually figured out a way to kind of fudge it enough for my purposes. I used the Sort tool to reverse sort on a copy of the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;objectID field. Then I used my little script (modified with help from the doc derklauer provided). Works like a charm and can probably be all thrown together in one python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 17:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-field-using-data-from-the-next-record/m-p/80487#M2804</guid>
      <dc:creator>BradCabe</dc:creator>
      <dc:date>2012-10-18T17:35:52Z</dc:date>
    </item>
  </channel>
</rss>

