<?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: attribute data to related record from parent feature using arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218684#M48196</link>
    <description>&lt;P&gt;No it generated same error&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2022 16:03:29 GMT</pubDate>
    <dc:creator>AdejumoBidemi</dc:creator>
    <dc:date>2022-10-04T16:03:29Z</dc:date>
    <item>
      <title>attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1217927#M48155</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use arcade to pull the address from&amp;nbsp;3 features. I want to pull the address into the related table iterating through the 3 features and pulling the first one found. The address will be pulled based on the global ID&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;P&gt;//create featuresSets for each Layer in the service&lt;BR /&gt;var p1 = FeatureSetByName($map,"parcel (LogTest )")&lt;BR /&gt;var p2 = FeatureSetByName($map,"building (LogTest )")&lt;BR /&gt;var p3 = FeatureSetByName($map,"facilities (LogTest)")&lt;/P&gt;&lt;P&gt;//Filter your FeatureSets by Site ID&lt;BR /&gt;var GUID = $feature.GLOBALID&lt;BR /&gt;var p1_filter = Filter(p1, "GUID = @$feature.GLOBALID")&lt;BR /&gt;var p2_filter = Filter(p2, "GUID = @$feature.GLOBALID")&lt;BR /&gt;var p3_filter = Filter(p3, "GUID = @$feature.GLOBALID")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Return the address of the parent feature&lt;BR /&gt;if(Count(p1_filter) &amp;gt; 0) {&lt;BR /&gt;return First(p2_filter).Address&lt;BR /&gt;}&lt;BR /&gt;else if(Count(p2_filter) &amp;gt; 0) {&lt;BR /&gt;return First(p3_filter).Address&lt;BR /&gt;}&lt;BR /&gt;else if(Count(p3_filter) &amp;gt; 0) {&lt;BR /&gt;return First(p3_filter).Address&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;else{&lt;BR /&gt;return null;&lt;BR /&gt;}&lt;/P&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 16:19:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1217927#M48155</guid>
      <dc:creator>AdejumoBidemi</dc:creator>
      <dc:date>2022-09-30T16:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218108#M48163</link>
      <description>&lt;UL&gt;&lt;LI&gt;You need to use a variable with the&amp;nbsp;@ notation in the Filter() function. You already created that variable, but then you try to use $feature in the sql statement, which doesn't work.&lt;/LI&gt;&lt;LI&gt;You're trying to return from the wrong featuresets for p1 and p2.&lt;/LI&gt;&lt;LI&gt;It should be faster to do the loading, filtering and returning for each layer before going to the next layer. This way, you don't unneccessarily load data.&lt;/LI&gt;&lt;LI&gt;You don't need all those else's. If you return from a function, everything after that return statement isn't executed anymore.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var GUID = $feature.GLOBALID

var p1 = FeatureSetByName($map,"parcel (LogTest )")
var p1_filter = Filter(p1, "GUID = @GUID")
if(Count(p1_filter) &amp;gt; 0) {
    return First(p1_filter).Address
}

var p2 = FeatureSetByName($map,"building (LogTest )")
var p2_filter = Filter(p2, "GUID = @GUID")
if(Count(p2_filter) &amp;gt; 0) {
    return First(p2_filter).Address
}

var p3 = FeatureSetByName($map,"facilities (LogTest)")
var p3_filter = Filter(p3, "GUID = @GUID")
if(Count(p3_filter) &amp;gt; 0) {
    return First(p3_filter).Address
}

return null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Oct 2022 20:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218108#M48163</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-01T20:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218587#M48188</link>
      <description>&lt;P&gt;Thanks so much Johannes. I tired the code and made the necessary adjustments as you suggest but I got the error below;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AdejumoBidemi_0-1664887871126.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52803iDBEBB350277696A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AdejumoBidemi_0-1664887871126.png" alt="AdejumoBidemi_0-1664887871126.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 12:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218587#M48188</guid>
      <dc:creator>AdejumoBidemi</dc:creator>
      <dc:date>2022-10-04T12:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218606#M48193</link>
      <description>&lt;P&gt;Huh... No idea.&lt;/P&gt;&lt;P&gt;Does it work if you take care of the formatting yourself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var where = `GUID = '${$feature.GLOBALID}'`

var p1 = FeatureSetByName($map,"parcel (LogTest )")
var p1_filter = Filter(p1, where)
if(Count(p1_filter) &amp;gt; 0) {
    return First(p1_filter).Address
}

var p2 = FeatureSetByName($map,"building (LogTest )")
var p2_filter = Filter(p2, where)
if(Count(p2_filter) &amp;gt; 0) {
    return First(p2_filter).Address
}

var p3 = FeatureSetByName($map,"facilities (LogTest)")
var p3_filter = Filter(p3, where)
if(Count(p3_filter) &amp;gt; 0) {
    return First(p3_filter).Address
}

return null&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 13:28:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218606#M48193</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-04T13:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218684#M48196</link>
      <description>&lt;P&gt;No it generated same error&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 16:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218684#M48196</guid>
      <dc:creator>AdejumoBidemi</dc:creator>
      <dc:date>2022-10-04T16:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218776#M48204</link>
      <description>&lt;P&gt;That's it, I'm calling in backup!&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;, any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 19:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218776#M48204</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-10-04T19:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218817#M48206</link>
      <description>&lt;P&gt;It's been a while since I saw that error message, but I seem to recall it being something very trivial, and not what I expected...&lt;/P&gt;&lt;P&gt;I know this is in the "AGOL" space, but I just want to confirm: the expression is running in AGOL, correct? If it's Portal, though, what version are you on?&lt;/P&gt;&lt;P&gt;Also, are these layers really related, as in, they have a relationship class? If so, you could just use &lt;STRONG&gt;FeatureSetByRelationShipName&lt;/STRONG&gt;, which pulls in related records, bypassing the need to apply a filter at all.&lt;/P&gt;&lt;P&gt;Also, &lt;STRONG&gt;GUID&lt;/STRONG&gt; is a function in Arcade. Maybe try avoiding that term?&lt;/P&gt;&lt;P&gt;I've tried setting up a similar situation with test data (including characters like "(" in the layer name), and I can't get it to break the same way.&lt;/P&gt;&lt;P&gt;Any chance any of these layers are public so that we can test an expression against the real data?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 20:44:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1218817#M48206</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-04T20:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1219275#M48230</link>
      <description>&lt;P&gt;Thanks so much &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;. I really appreciate. The error is from AGOL and they are related. I tried the&amp;nbsp;&lt;STRONG&gt;FeatureSetByRelationShipName&amp;nbsp;&lt;/STRONG&gt;but still generated the same error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;No the data are not but I can request to make a part of it public.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 12:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1219275#M48230</guid>
      <dc:creator>AdejumoBidemi</dc:creator>
      <dc:date>2022-10-06T12:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: attribute data to related record from parent feature using arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1219544#M48246</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 19:05:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/attribute-data-to-related-record-from-parent/m-p/1219544#M48246</guid>
      <dc:creator>AdejumoBidemi</dc:creator>
      <dc:date>2022-10-06T19:05:07Z</dc:date>
    </item>
  </channel>
</rss>

