<?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 Fetch an attribute from a related record in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/fetch-an-attribute-from-a-related-record/m-p/1330112#M7038</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I have a point layer and three related tables in a collection map on Field Maps. In the form of one of the tables, I want a text field to auto fill based on what's in a text fields in the point layer. I'm brand new to using expressions in Field Maps, and so tried adapting the following from one of Esri's posted examples on Common calculated expressions, but get an error in Field Maps saying "Failed to calculate". Any help would be great. Thanks.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Sept_Measure_Butternut_data_sheet'&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'current_plant_source'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!&lt;/SPAN&gt;&lt;SPAN&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt;)) {&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;'current_plant_source'&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;null&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I've also tried the following, with no luck.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;var related_features = FeatureSetByRelationshipName($feature, "Sept_Measure_Butternut_data_sheet", ["current_plant_source"], false)
var related_feature = First(related_features)

if(related_feature == null) {
    return null  
}

return related_feature.current_plant_source&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 19 Sep 2023 14:24:22 GMT</pubDate>
    <dc:creator>Sarah-CodyKnight</dc:creator>
    <dc:date>2023-09-19T14:24:22Z</dc:date>
    <item>
      <title>Fetch an attribute from a related record</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/fetch-an-attribute-from-a-related-record/m-p/1330112#M7038</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I have a point layer and three related tables in a collection map on Field Maps. In the form of one of the tables, I want a text field to auto fill based on what's in a text fields in the point layer. I'm brand new to using expressions in Field Maps, and so tried adapting the following from one of Esri's posted examples on Common calculated expressions, but get an error in Field Maps saying "Failed to calculate". Any help would be great. Thanks.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByRelationshipName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Sept_Measure_Butternut_data_sheet'&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'current_plant_source'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!&lt;/SPAN&gt;&lt;SPAN&gt;IsEmpty&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt;)) {&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;plants_sept_source&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;'current_plant_source'&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;null&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#800000"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I've also tried the following, with no luck.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;var related_features = FeatureSetByRelationshipName($feature, "Sept_Measure_Butternut_data_sheet", ["current_plant_source"], false)
var related_feature = First(related_features)

if(related_feature == null) {
    return null  
}

return related_feature.current_plant_source&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 Sep 2023 14:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/fetch-an-attribute-from-a-related-record/m-p/1330112#M7038</guid>
      <dc:creator>Sarah-CodyKnight</dc:creator>
      <dc:date>2023-09-19T14:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch an attribute from a related record</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/fetch-an-attribute-from-a-related-record/m-p/1330685#M7051</link>
      <description>&lt;P&gt;I am not sure you will get null at all.&amp;nbsp; What I do is use count like this.&lt;/P&gt;&lt;P&gt;var related_features = FeatureSetByRelationshipName($feature, "Sept_Measure_Butternut_data_sheet", ["current_plant_source"], false)&lt;/P&gt;&lt;P&gt;if count(related_features) == 0 {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return "none found"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;else {&lt;/P&gt;&lt;P&gt;return First(related_features).current_plant_source&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Note syntax is not perfect but I hope you get the idea.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 16:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/fetch-an-attribute-from-a-related-record/m-p/1330685#M7051</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2023-09-20T16:09:05Z</dc:date>
    </item>
  </channel>
</rss>

