<?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 How to query a table stored in AGOL using Arcade in Model Builder? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-query-a-table-stored-in-agol-using-arcade/m-p/1396226#M80355</link>
    <description>&lt;P&gt;I need to populate a field in an AGOL point feature service by grabbing the most recent record from a related table also hosted in AGOL (Sites and InspectionReports).&amp;nbsp; I can do this in AGOL data view using an Arcade expression but I want to automate it in Model Builder and schedule it in ArcGIS Pro.&amp;nbsp; Right now I can sort the records in InspectionReports to upend the most recent inspection into Sites using the following Arcade expression in AGOL data view but I'm curious if I can translate this to Calculate Field in Model Builder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var ordered = OrderBy(FeatureSetByRelationshipName($feature, "InspectionReports"), "i_site_date DES")&lt;BR /&gt;var site = $feature.DBID&lt;BR /&gt;var related = Filter(ordered, "DBID = @site")&lt;BR /&gt;var relatedfeatures = Filter(related,"Report_type LIKE '%Inspection'")&lt;BR /&gt;var last = First(relatedfeatures)&lt;/P&gt;&lt;P&gt;var result;&lt;BR /&gt;if(last == null) {&lt;BR /&gt;result = Text("")&lt;BR /&gt;} else {&lt;BR /&gt;result = last.i_site_date&lt;BR /&gt;}&lt;BR /&gt;return result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I reference an AGOL table as I did with &lt;STRONG&gt;FeatureSetByRelationshipName($feature, "InspectionReports"), "i_site_date DES") &lt;/STRONG&gt;in a Calculate Field Arcade script?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2024 19:01:09 GMT</pubDate>
    <dc:creator>NoahWasserman</dc:creator>
    <dc:date>2024-03-14T19:01:09Z</dc:date>
    <item>
      <title>How to query a table stored in AGOL using Arcade in Model Builder?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-query-a-table-stored-in-agol-using-arcade/m-p/1396226#M80355</link>
      <description>&lt;P&gt;I need to populate a field in an AGOL point feature service by grabbing the most recent record from a related table also hosted in AGOL (Sites and InspectionReports).&amp;nbsp; I can do this in AGOL data view using an Arcade expression but I want to automate it in Model Builder and schedule it in ArcGIS Pro.&amp;nbsp; Right now I can sort the records in InspectionReports to upend the most recent inspection into Sites using the following Arcade expression in AGOL data view but I'm curious if I can translate this to Calculate Field in Model Builder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var ordered = OrderBy(FeatureSetByRelationshipName($feature, "InspectionReports"), "i_site_date DES")&lt;BR /&gt;var site = $feature.DBID&lt;BR /&gt;var related = Filter(ordered, "DBID = @site")&lt;BR /&gt;var relatedfeatures = Filter(related,"Report_type LIKE '%Inspection'")&lt;BR /&gt;var last = First(relatedfeatures)&lt;/P&gt;&lt;P&gt;var result;&lt;BR /&gt;if(last == null) {&lt;BR /&gt;result = Text("")&lt;BR /&gt;} else {&lt;BR /&gt;result = last.i_site_date&lt;BR /&gt;}&lt;BR /&gt;return result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I reference an AGOL table as I did with &lt;STRONG&gt;FeatureSetByRelationshipName($feature, "InspectionReports"), "i_site_date DES") &lt;/STRONG&gt;in a Calculate Field Arcade script?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 19:01:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-query-a-table-stored-in-agol-using-arcade/m-p/1396226#M80355</guid>
      <dc:creator>NoahWasserman</dc:creator>
      <dc:date>2024-03-14T19:01:09Z</dc:date>
    </item>
  </channel>
</rss>

