<?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: populate values from another table based on a common field using attribute rules in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1306038#M70841</link>
    <description>&lt;P&gt;Thanks Johannes. It works!!! actullay I really dont know arcade that much. but it makes sense! I didnt think about loading the look up field!&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2023 06:53:02 GMT</pubDate>
    <dc:creator>MR-QE</dc:creator>
    <dc:date>2023-07-06T06:53:02Z</dc:date>
    <item>
      <title>populate values from another table based on a common field using attribute rules</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1305667#M70805</link>
      <description>&lt;P&gt;I try to use attribute rules to populate values from a standalone table when a common field of 2 tables is the same.&lt;/P&gt;&lt;P&gt;here is the arcade code:&lt;/P&gt;&lt;P&gt;var sourceTable = FeatureSetByName($datastore,"Arten_gesamt", ["Art_wissenschaftlich"], false)&lt;BR /&gt;var lookupField = "Kategorie_Gruppe"&lt;BR /&gt;var commonField = "Art_wissenschaftlich"&lt;BR /&gt;var lookupValue = $feature["Art_wissenschaftlich"]&lt;BR /&gt;var matchedFeatures = Filter(sourceTable, commonField + " = " + lookupValue)&lt;BR /&gt;var matchedFeature = First(matchedFeatures)&lt;BR /&gt;return matchedFeature[lookupField]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It means that when the "Art_wissenschaftlich" is the same in 2 tables, it brings "Kategorie_Gruppe" values. But it doesnt work! i get this error on line 6:&amp;nbsp;&amp;nbsp;Invalid where clause (Art_wissenschaftlich = )&lt;/P&gt;&lt;P&gt;the source table is the table where the values come.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I appreciate any guidance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 08:33:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1305667#M70805</guid>
      <dc:creator>MR-QE</dc:creator>
      <dc:date>2023-07-05T08:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: populate values from another table based on a common field using attribute rules</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1305694#M70811</link>
      <description>&lt;P&gt;Your Artwissenschaftlich field is most probably a text field, containing values like "Homo sapiens sapiens".&lt;/P&gt;&lt;P&gt;Your constructed SQL query looks like this:&lt;/P&gt;&lt;P&gt;Art_wissenschaftlich = Homo sapiens sapiens&lt;/P&gt;&lt;P&gt;But it should look like this:&lt;/P&gt;&lt;P&gt;Art_wissenschaftlich = &lt;STRONG&gt;'&lt;/STRONG&gt;Homo sapiens sapiens&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arcade automatically cares about the correct syntax if you use the&amp;nbsp;@ notation.&lt;/P&gt;&lt;P&gt;Other notes:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You're not loading your lookup field&lt;/LI&gt;&lt;LI&gt;You're need to check if your Filter() found any related features&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var lookupField = "Kategorie_Gruppe"
var commonField = "Art_wissenschaftlich"
var sourceTable = FeatureSetByName($datastore,"Arten_gesamt", [commonField, lookupField], false)

var commonValue = $feature[commonField]
var matchedFeatures = Filter(sourceTable, `${commonField} = @commonValue`)
var matchedFeature = First(matchedFeatures)
return Iif(matchedFeature == null, "not found", matchedFeature[lookupField])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or shorter, with hard-coded field names:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sourceTable = FeatureSetByName($datastore,"Arten_gesamt", ["Art_wissenschaftlich", "Kategorie_Gruppe"], false)
var art= $feature.Art_wissenschaftlich
var matchedFeature = First(Filter(sourceTable, "Art_wissenschaftlich = &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/481937"&gt;@ART&lt;/a&gt;"))
return Iif(matchedFeature == null, "not found", matchedFeature.Kategorie_Gruppe)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 11:24:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1305694#M70811</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-07-05T11:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: populate values from another table based on a common field using attribute rules</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1306038#M70841</link>
      <description>&lt;P&gt;Thanks Johannes. It works!!! actullay I really dont know arcade that much. but it makes sense! I didnt think about loading the look up field!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 06:53:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/populate-values-from-another-table-based-on-a/m-p/1306038#M70841</guid>
      <dc:creator>MR-QE</dc:creator>
      <dc:date>2023-07-06T06:53:02Z</dc:date>
    </item>
  </channel>
</rss>

