<?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 calaculate values in feild calculator ysing python in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calaculate-values-in-feild-calculator-ysing-python/m-p/1183571#M56253</link>
    <description>&lt;P&gt;hello , i have 8 points with Z value .&lt;/P&gt;&lt;P&gt;each 2 points is a pair ( see the colors in the image attached).&lt;/P&gt;&lt;P&gt;i created a new feild calles "Delta" that in their i want the result of the difference between a pair..&lt;/P&gt;&lt;P&gt;for example the difference between point 2 to 1 is 4.66 meters..&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calc2.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/43627i9388C59CACD31EFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="calc2.jpg" alt="calc2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; is there a way to do this via while or for loop ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help!&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 15:05:29 GMT</pubDate>
    <dc:creator>matu89</dc:creator>
    <dc:date>2022-06-16T15:05:29Z</dc:date>
    <item>
      <title>calaculate values in feild calculator ysing python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calaculate-values-in-feild-calculator-ysing-python/m-p/1183571#M56253</link>
      <description>&lt;P&gt;hello , i have 8 points with Z value .&lt;/P&gt;&lt;P&gt;each 2 points is a pair ( see the colors in the image attached).&lt;/P&gt;&lt;P&gt;i created a new feild calles "Delta" that in their i want the result of the difference between a pair..&lt;/P&gt;&lt;P&gt;for example the difference between point 2 to 1 is 4.66 meters..&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calc2.jpg" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/43627i9388C59CACD31EFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="calc2.jpg" alt="calc2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; is there a way to do this via while or for loop ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 15:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calaculate-values-in-feild-calculator-ysing-python/m-p/1183571#M56253</guid>
      <dc:creator>matu89</dc:creator>
      <dc:date>2022-06-16T15:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: calaculate values in feild calculator ysing python</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calaculate-values-in-feild-calculator-ysing-python/m-p/1184458#M56370</link>
      <description>&lt;P&gt;Using the field calculator with a Python 3 expression, use this formula to populate the records with an even OBJECTID with the Delta between the current and previous Z value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;GetDelta(!OBJECTID!, !Z!)&lt;/LI-CODE&gt;&lt;P&gt;Code Block:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;previousZ = 0
def GetDelta(objectId, zValue):
    global previousZ
    # Don't calculate Delta for odd numbered OBJECTIDs
    if (objectId % 2 != 0):
        previousZ = zValue
        return None
    
    if (previousZ):
        #Get the absolute value of the difference
        difference = abs(zValue - previousZ)
    else:
        difference = 0
        #Update the previousZ global variable with the latest Z value
    previousZ = zValue
    return difference&lt;/LI-CODE&gt;&lt;P&gt;This would have to be run on all records or an even number of records starting with an odd value.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 20:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calaculate-values-in-feild-calculator-ysing-python/m-p/1184458#M56370</guid>
      <dc:creator>JesseWickizer</dc:creator>
      <dc:date>2022-06-20T20:27:05Z</dc:date>
    </item>
  </channel>
</rss>

