<?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: Automatically populating related table field with parent table data? in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1172286#M3346</link>
    <description>&lt;P&gt;You're halfway there!&lt;/P&gt;&lt;P&gt;The FeatureSetBy*() functions return feature sets, collection of features. You have to select 1 of those features (often the first one) and return 1 of its attributes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// load all related features
var related_features = FeatureSetByRelationshipName($feature, "SepticLocations", ["inspect_freq"], false)

// select one of those features, here we just grab the first one
var related_feature = First(related_features)

// if there are no related features, related_feature will be null and we will
// get an error down the line, so we need to check that and return early
if(related_feature == null) {
    return null  // if there are no related features, we return a default value (null in this case)
}

// return an attribute
return related_feature.inspect_freq&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 10 May 2022 05:50:42 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-05-10T05:50:42Z</dc:date>
    <item>
      <title>Automatically populating related table field with parent table data?</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1172223#M3343</link>
      <description>&lt;P&gt;I have a point layer with a SiteID field linked to a related table with SiteKey (similar setup to the ESRI Hydrant Inspection tutorial).&amp;nbsp; For each point there are multiple rows in the related table ("1:M"; e.g. hydrants and inspection records). I can't figure out how to use FeatureSetByRelationshipName (or another function?) to simply pull a number from the parent point layer into each inspection record.&amp;nbsp; I have a constant in the point attribute table (different for each point) that I need to use in an expression when recording new records in the related table. I keep getting the objectID along with the value I want which won't populate an integer field.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 22:14:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1172223#M3343</guid>
      <dc:creator>NoahWasserman</dc:creator>
      <dc:date>2022-05-09T22:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically populating related table field with parent table data?</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1172286#M3346</link>
      <description>&lt;P&gt;You're halfway there!&lt;/P&gt;&lt;P&gt;The FeatureSetBy*() functions return feature sets, collection of features. You have to select 1 of those features (often the first one) and return 1 of its attributes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// load all related features
var related_features = FeatureSetByRelationshipName($feature, "SepticLocations", ["inspect_freq"], false)

// select one of those features, here we just grab the first one
var related_feature = First(related_features)

// if there are no related features, related_feature will be null and we will
// get an error down the line, so we need to check that and return early
if(related_feature == null) {
    return null  // if there are no related features, we return a default value (null in this case)
}

// return an attribute
return related_feature.inspect_freq&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 May 2022 05:50:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1172286#M3346</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-10T05:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically populating related table field with parent table data?</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1211233#M4447</link>
      <description>&lt;P&gt;Reading through your code, I can't tell what of my own Globals to fill in.&amp;nbsp;&lt;/P&gt;&lt;P&gt;simplified, I have a layer called Plants. Then I have a related table called Plant Inspections. I am trying to calculate the Site Name (and other fields) for my related table by what is already in the layer, as OP was.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The green font (Septic Locations) came from where? Is that the Layer name? And if so, is the [inspect_freq] the equivalent of Site Name? Would this site name be from under the layer or from under the table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 18:30:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1211233#M4447</guid>
      <dc:creator>RenM000</dc:creator>
      <dc:date>2022-09-09T18:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically populating related table field with parent table data?</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1211350#M4452</link>
      <description>&lt;P&gt;This code uses &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyrelationshipname" target="_blank" rel="noopener"&gt;FeatureSetByRelationshipName()&lt;/A&gt;, which returns the related features based on a relationship class.&lt;/P&gt;&lt;P&gt;SepticLocations is the name of the relationship class, inspect_freq is the name of a field in the related table.&lt;/P&gt;&lt;P&gt;If you haven't built a relationship class, you can load the related table with &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyname" target="_blank" rel="noopener"&gt;FeatureSetByName()&lt;/A&gt; or one of the other FeatureSetBy*() functions and then &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#filter" target="_blank" rel="noopener"&gt;Filter()&lt;/A&gt; it.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2022 09:23:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/automatically-populating-related-table-field-with/m-p/1211350#M4452</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-10T09:23:10Z</dc:date>
    </item>
  </channel>
</rss>

