<?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 with Arcade Expression &amp;amp; Related Table in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225134#M61509</link>
    <description>&lt;P&gt;Do you actually have a relationship class between your feature class and the inspection table? Is it named "gas.GU.VALVEINSP"?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2022 12:33:06 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-10-25T12:33:06Z</dc:date>
    <item>
      <title>Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225114#M61504</link>
      <description>&lt;P&gt;Wanting to write an Arcade expression, and schedule it to run daily, that will populate a "Last Inspected" attribute on a feature layer, based on the most recent related table record.&lt;/P&gt;&lt;P&gt;I've tried a few examples I've copied from other posts, but I'm guessing "FeatureSetBy..." doesn't work in field calculator?&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 11:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225114#M61504</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-10-25T11:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225126#M61506</link>
      <description>&lt;P&gt;The FeaturesetBy* functions should be available.&lt;/P&gt;&lt;P&gt;You can do it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// load the table, this assumes you have a relationship class
var inspections = FeaturesetByRelationshipName($feature, "RelationshipName")

// sort descendingly by the date field
var latest_inspection = First(OrderBy(inspections, "DateField DESC"))

// no inspection found -&amp;gt; return a default value
if(latest_inspection == null) { return null }

// else return the date field of the latest inspection
return latest_inspection.DateField&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:12:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225126#M61506</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T12:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225130#M61507</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;&lt;P&gt;It's advising there's an error on line 5:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_0-1666700678698.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54349i4453A5C69C262D3B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_0-1666700678698.png" alt="JasonCyphers_0-1666700678698.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:24:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225130#M61507</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-10-25T12:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225134#M61509</link>
      <description>&lt;P&gt;Do you actually have a relationship class between your feature class and the inspection table? Is it named "gas.GU.VALVEINSP"?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:33:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225134#M61509</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-25T12:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225138#M61510</link>
      <description>&lt;P&gt;Are you set on using Arcade? I have a script in python that I use for this same purpose, but haven't translated into any other languages.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:36:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225138#M61510</guid>
      <dc:creator>drWood</dc:creator>
      <dc:date>2022-10-25T12:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225141#M61511</link>
      <description>&lt;P&gt;Oops...no.&amp;nbsp; But, I did change to the correct name, but it still gives the same error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_0-1666701477711.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54352iC08D224B0F3D26A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_0-1666701477711.png" alt="JasonCyphers_0-1666701477711.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonCyphers_1-1666701501099.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/54353i08FF1637E2F48015/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonCyphers_1-1666701501099.png" alt="JasonCyphers_1-1666701501099.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225141#M61511</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-10-25T12:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225142#M61512</link>
      <description>&lt;P&gt;I'm not dead-set on using Arcade.&amp;nbsp; I'd be open to other languages, as long as they result in the same outcome.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225142#M61512</guid>
      <dc:creator>JasonCyphers</dc:creator>
      <dc:date>2022-10-25T12:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Field with Arcade Expression &amp; Related Table</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225146#M61513</link>
      <description>&lt;P&gt;The below Python3 code is what I use to update the Last Assessment field for stormwater assets that we maintain. You can run the individual geoprocessing tools and copy the python script to your clipboard from the History pane if you need to get the correct formatting for all the variables. I haven't automated our use of it yet, but I believe it's just a matter of scheduling it to run.&lt;/P&gt;&lt;P&gt;arcpy.management.Sort("Stormwater_Assets.STORM_ADMIN.DSTRUCTUREASSESSMENT", r"R:\Derek\ArcPro\WAMS - Work Order Updates\Stormwater Assets.gdb\DSTRUCTUREASSESSMENT_DescendingDate", "InspectionDate DESCENDING", "UR")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.management.AddJoin(r"dDropStructure", "FacilityID", "DSTRUCTUREASSESSMENT_DescendingDate", "FacilityID", "KEEP_ALL", "NO_INDEX_JOIN_FIELDS")&lt;BR /&gt;arcpy.management.SelectLayerByAttribute(r"dDropStructure", "NEW_SELECTION", "Ownership = 'PAC'", None)&lt;BR /&gt;arcpy.management.CalculateField(r"dDropStructure", "Last_Asmt", "!DSTRUCTUREASSESSMENT_DescendingDate.InspectionDate!", "PYTHON3", '', "TEXT", "NO_ENFORCE_DOMAINS")&lt;/P&gt;&lt;P&gt;arcpy.management.RemoveJoin(r"dDropStructure", "DSTRUCTUREASSESSMENT_DescendingDate")&lt;/P&gt;&lt;P&gt;arcpy.management.Delete("DSTRUCTUREASSESSMENT_DescendingDate", "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 12:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculate-field-with-arcade-expression-amp-related/m-p/1225146#M61513</guid>
      <dc:creator>drWood</dc:creator>
      <dc:date>2022-10-25T12:48:03Z</dc:date>
    </item>
  </channel>
</rss>

