<?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: Arcade - FeatureSetByRelationshipName - Calculate Field in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107294#M42567</link>
    <description>&lt;P&gt;Yea you need to filter it for the feature you want.&amp;nbsp; Like other poster said use First since 1 result will be faster.&amp;nbsp; Also do not return geo (the false part).&lt;/P&gt;&lt;P&gt;var sql = "PointID = '" + $feature.PointID + "'";&lt;BR /&gt;var tbl = Filter(FeatureSetByName($map,"Points", ['FieldNameHere'], false), sql);&lt;BR /&gt;return First(tbl).FieldNameHere&lt;/P&gt;</description>
    <pubDate>Wed, 13 Oct 2021 20:47:06 GMT</pubDate>
    <dc:creator>DougBrowning</dc:creator>
    <dc:date>2021-10-13T20:47:06Z</dc:date>
    <item>
      <title>Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101685#M42288</link>
      <description>&lt;P&gt;I was wondering if it was possible to use&amp;nbsp;FeatureSetByRelationshipName to calculate fields in a related feature class?&lt;/P&gt;&lt;P&gt;What I want to do is carry the values from a field in featureclass1 to an empty field in featureclass2. I can successfully achieve this in a popup in AGOL, but I want to do be able to achieve this in Field Calculator, and then ultimately Python to automate the process.&lt;/P&gt;&lt;P&gt;At the moment, I am using the below expression for the popup, but it doesn't seem to work in Field Calculator:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var relatedrecords = FeatureSetByRelationshipName($feature,"[relationship_name]")&lt;BR /&gt;&lt;BR /&gt;for (var f in relatedrecords){&lt;BR /&gt;return f.[field_name]&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 19:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101685#M42288</guid>
      <dc:creator>RonParis</dc:creator>
      <dc:date>2021-10-13T19:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101695#M42291</link>
      <description>&lt;P&gt;The FeatureSetBy... functions should all work in the Field Calculate profile of Arcade.&lt;/P&gt;&lt;P&gt;Your expression as written is only going to return a value from the first record in the &lt;EM&gt;relatedrecords &lt;/EM&gt;FeatureSet, though; is that your intention?&lt;/P&gt;&lt;P&gt;If so, you can try using First(relatedrecords) instead of a loop.&lt;/P&gt;&lt;P&gt;Also, are you certain that every feature has related records?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 16:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101695#M42291</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-09-24T16:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101910#M42301</link>
      <description>&lt;P&gt;Hi Josh,&lt;/P&gt;&lt;P&gt;Thanks for the reply. It's a one to many relationship so there will always only be one record to return anyway, and I'm trying to pull the value from the origin to the destination.&lt;/P&gt;&lt;P&gt;As mentioned, this method works perfectly in an AGOL popup, but can't seem to apply the same method in Field Calculator. It's worth mentioning the Field Calculator successfully carries out the calculation, but no values are returned.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 13:33:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1101910#M42301</guid>
      <dc:creator>RonParis</dc:creator>
      <dc:date>2021-09-25T13:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107144#M42556</link>
      <description>&lt;P&gt;Whenever I am outside AGOL web map I have had better luck using the By Portal Item one.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyportalitem" target="_blank"&gt;https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyportalitem&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope that works.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 16:12:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107144#M42556</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-10-13T16:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107256#M42561</link>
      <description>&lt;P&gt;Thanks for the response Doug. Is this instead of using&amp;nbsp;FeatureSetByRelationshipName? Like mentioned, I'm grabbing a value from the origin and populating the foreign&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 19:01:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107256#M42561</guid>
      <dc:creator>RonParis</dc:creator>
      <dc:date>2021-10-13T19:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107259#M42562</link>
      <description>&lt;P&gt;Yes you use it instead of.&amp;nbsp; It gives a more specific location which works in ArcPro and such. Other than that it works the same.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 19:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107259#M42562</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-10-13T19:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107274#M42565</link>
      <description>&lt;P&gt;Thanks Doug, not sure if I'm missing something, have tried....&lt;/P&gt;&lt;PRE&gt;var relatedrecords = FeatureSetByPortalItem(Portal([portal]),[item_id],0,[field_name])&lt;BR /&gt;&lt;BR /&gt;for (var f in relatedrecords){&lt;BR /&gt;return f.[field_name]&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;You're correct, it's pulling through a value, but it's not pulling through the correct related value. It looks just grabbing the first value from the feature set (OID 1)&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 19:46:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107274#M42565</guid>
      <dc:creator>RonParis</dc:creator>
      <dc:date>2021-10-13T19:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107294#M42567</link>
      <description>&lt;P&gt;Yea you need to filter it for the feature you want.&amp;nbsp; Like other poster said use First since 1 result will be faster.&amp;nbsp; Also do not return geo (the false part).&lt;/P&gt;&lt;P&gt;var sql = "PointID = '" + $feature.PointID + "'";&lt;BR /&gt;var tbl = Filter(FeatureSetByName($map,"Points", ['FieldNameHere'], false), sql);&lt;BR /&gt;return First(tbl).FieldNameHere&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 20:47:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107294#M42567</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-10-13T20:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade - FeatureSetByRelationshipName - Calculate Field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107450#M42575</link>
      <description>&lt;P&gt;Thanks Doug, have undertaken the following and is working successfully!&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; sql &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"GlobalID = '"&lt;/SPAN&gt; &lt;SPAN class=""&gt;+&lt;/SPAN&gt; &lt;SPAN class=""&gt;$feature&lt;/SPAN&gt;.RELGlobalID &lt;SPAN class=""&gt;+&lt;/SPAN&gt; &lt;SPAN class=""&gt;"'"&lt;/SPAN&gt;;&lt;BR /&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt;&lt;SPAN class=""&gt; layer &lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;Portal&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;'https://www.arcgis.com'&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;, [item_id]&lt;/SPAN&gt;&lt;SPAN class=""&gt;, &lt;/SPAN&gt;&lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;[&lt;/SPAN&gt;field_name&lt;SPAN class=""&gt;]&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;SPAN class=""&gt;false&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; tbl &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;Filter&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;layer, sql&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;First&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;tbl&lt;SPAN class=""&gt;)&lt;/SPAN&gt;.[field_name]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 11:04:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-featuresetbyrelationshipname-calculate/m-p/1107450#M42575</guid>
      <dc:creator>RonParis</dc:creator>
      <dc:date>2021-10-14T11:04:57Z</dc:date>
    </item>
  </channel>
</rss>

